安装软件包后,我收到此消息:
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 audit fix --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 audit fix 还是忽略警告。我怎样才能让我的应用程序重新运行?
它在我运行强制修复后显示此消息,但已经运行命令为时已晚:
npm WARN using --force I sure hope you know what you are doing.
安装的软件包:
https://stackblitz.com/edit/typescript-uuubb8
最佳答案
始终小心 --force
旗帜。这就像通过拔出电缆来关闭计算机。你基本上“强制” NPM 做你想让它做的事情,即使 NPM 知道你的应用程序会崩溃。
要解决此问题,您必须手动还原更改。
您也可以尝试运行 npm update
.它将更新每个包(但之前备份您的项目!)。也许这足以解决它。
如果您将来必须修复漏洞,请不要使用 --force
旗帜。如果这不起作用,请通过运行 npm audit
手动执行此操作: 它将向您显示问题的详细信息,而无需执行任何操作。
关于angular - npm 审计修复 --force 导致错误 : Data path ".builders[' app-shell' ]"should have required property ' class',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56522180/