【问题标题】:npm audit fix --force causes error: Data path ".builders['app-shell']" should have required property 'class'npm audit fix --force 导致错误:数据路径“.builders['app-shell']”应该具有必需的属性“类”
【发布时间】:2019-06-10 07:24:33
【问题描述】:

我在安装软件包后收到此消息:

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

【问题讨论】:

    标签: angular npm angular-cli


    【解决方案1】:

    始终小心--force 标志。这就像通过拔出电缆来关闭计算机。你基本上是“强制” NPM 做你想做的事,即使 NPM 知道你的应用会崩溃。

    要解决此问题,您必须手动还原更改。

    您也可以尝试运行npm update。它将更新每个包(但之前备份您的项目!)。也许这足以解决它。

    如果您将来必须修复漏洞,请不要使用--force 标志。如果这不起作用,请通过运行 npm audit 手动执行:它将向您显示问题的详细信息,而无需执行任何操作。

    【讨论】:

    • 该选项如果不能轻易反转,不建议使用,幸运的是我之前提交了代码
    猜你喜欢
    • 1970-01-01
    • 2021-01-28
    • 1970-01-01
    • 2019-10-25
    • 2020-02-10
    • 2021-06-19
    • 1970-01-01
    • 2019-11-25
    • 1970-01-01
    相关资源
    最近更新 更多