文章内容

2020/5/11 10:16:05,作 者: 黄兵

npm audit fix 命令

最近需要更新Angular一些安装包,出现了如下提示:

found 2 low severity vulnerabilities

  run `npm audit fix` to fix them, or `npm audit` for details

发现两个严重程度较低的漏洞,运行'npm audit fix'进行修复,或者运行'npm audit'查看详情。

具体npm audit fix是什么命令,具体解释如下:

# 扫描项目漏洞把不安全的依赖项自动更新到兼容性版本
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


参考资料:

1、npm audit 二三事

分享到:

发表评论

评论列表