npm仅审核依赖项?

use*_*990 5 security audit node.js npm angular

当前,npm audit在项目中运行时,它会同时检查dependenciesdevDependencies。我正在寻找一种仅检查的方法dependencies。目前有办法吗?

Joe*_*eer 16

--production在 npm 6.10.0 中发布了对flag 的支持

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

npm audit --production


Sco*_*t G 6

您应该使用--omit=dev而不是--production根据更新npm版本上的警告:

$ npm audit --production
npm WARN config production Use `--omit=dev` instead.
Run Code Online (Sandbox Code Playgroud)

它似乎已被弃用npm v8.7.0。我无法确认,但这个 PR 似乎与我的研究最相关: https: //github.com/npm/cli/pull/4744

查看 PR 的描述,您可能--omit peer也应该指定。