npm audit使用笔记

910 阅读1分钟

扫描项目漏洞把不安全的依赖项自动更新到兼容性版本

npm audit fix

在不修改 node_modules 的情况下执行 audit fix,仍然会更改 pkglock

npm audit fix --package-lock-only

跳过更新 devDependencies

npm audit fix --only=prod

强制执行 audit fix 安装最新的依赖项(toplevel)

npm audit fix --force

单纯的获取 audit fix 会做的事,并以 json 格式输出。

npm audit fix --dry-run --json

获取详情

npm audit

以 JSON 格式打印报告

npm audit --json