Search code examples
node.jssecuritynpmaudit

npm audit only for production dependencies?


Currently, when running npm audit in a project, it checks both the dependencies and the devDependencies. I am looking for a way to only check the dependencies. Is there currently a way to do so?


Solution

  • Support for --production flag was released in npm 6.10.0

    https://github.com/npm/cli/pull/202

    npm audit --production

    The --omit flag was added in npm 7.x and is now preferred.

    https://docs.npmjs.com/cli/v8/commands/npm-audit/#omit

    npm audit --omit=dev