首先安装npm-audit-html
npm i -g npm-audit-html
然后输出报告
npm audit --json | npm-audit-html
结果report.html会创建在根目录,打开后如图所示
![](https://img-blog.csdnimg.cn/img_convert/c0d2f5330e4c1c265add6e7cad243312.png)
注意事项
如果你使用的是淘宝或者华为镜像源,你将无法使用npm audit的功能,需要换回官方的源
npm config set registry https://registry.npmjs.org/
参考资料
npm-audit
Display npm audit vulnerabilities in html format