安装软件包后,我收到此消息:
added 1 package from 8 contributors and audited 49729 packages in 23.754s
found 25 vulnerabilities (1 low, 24 high)
run `npm audit fix` to fix them, or `npm audit` for details
所以我运行了npm audit fix
,它修复了一些漏洞。
...
+ @angular-devkit/build-ng-packagr@0.800.2
+ @angular-devkit/build-angular@0.800.2
added 125 packages from 72 contributors, updated 8 packages and moved 16 packages in 65.005s
fixed 12 of 25 vulnerabilities in 49729 scanned packages
3 package updates for 13 vulns involved breaking changes
(use `npm audit fix --force` to install breaking changes; or refer to `npm audit` for steps to fix these manually)
它建议使用npm审核修复程序--force,我用过它,现在当我尝试运行Angular应用程序时出现此错误:
Schema validation failed with the following errors:
Data path ".builders['app-shell']" should have required property 'class'.
Error: Schema validation failed with the following errors:
这是怎么回事,应该使用npm审核修复程序还是忽略警告。如何使我的应用重新运行?
运行强制修复后显示此消息,但已经运行命令为时已晚:
npm WARN using --force I sure hope you know what you are doing.
已安装的软件包:
答案 0 :(得分:1)
请始终注意--force
标志。这就像通过拔出电缆来关闭计算机一样。您基本上可以“强迫” NPM进行您想做的事情,即使NPM知道您的应用程序随后也会崩溃。
要解决此问题,您必须手动还原更改。
您也可以尝试运行npm update
。它将更新每个软件包(但请先备份您的项目!)。也许这足以解决它。
如果将来必须修复漏洞,请在没有--force
标志的情况下进行修复。如果这不起作用,请通过运行npm audit
手动进行操作:它将向您显示问题的详细信息,而无需执行任何操作。