https://blog.csdn.net/weixin_40817115/article/details/81007774
npm audit : npm@5.10.0 & npm@6,允許開發人員分析復雜的代碼,並查明特定的漏洞和缺陷。
npm audit fix :npm@6.1.0, 檢測項目依賴中的漏洞並自動安裝需要更新的有漏洞的依賴,而不必再自己進行跟蹤和修復。
同時,官網中還提供了一些其他的命令,整理如下:
1. 運行audit fix,但是只更新pkglock, 不更新node_modules:
$ npm audit fix --package-lock-only
2. 只更新dependencies中安裝的包,跳過devDependencies中的包:
$ npm audit fix --only=prod
3.運行命令,得到audit fix將會更新的內容,並且輸出json格式的安裝信息,但是並不真的安裝更新:
$ npm audit fix --dry-run --json
4. 得到json格式的詳細檢測報告
$ npm audit --json
附:
npm-audit 官網地址:https://docs.npmjs.com/cli/audit
---------------------
作者:奮斗的小綠蘿
來源:CSDN
原文:https://blog.csdn.net/weixin_40817115/article/details/81007774
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!