npm审计修复angular10.0.1后的错误
我今天运行了这个较旧的 10.0.1 angular 项目,它告诉我它有很多低漏洞和一些高漏洞。所以我运行 npm audit fix 来修复它们。但是现在当我尝试运行它时,它给了我这些错误:
Error: ./src/main.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: angularCompiler.getResourceDependencies(...) is not a function or its return value is not iterable
at getDependencies (C:Webvgcvgcnode_modules@ngtoolswebpacksrcivyplugin.js:261:56)
at C:Webvgcvgcnode_modules@ngtoolswebpacksrcivyplugin.js:374:20
at analyzingFileEmitter (C:Webvgcvgcnode_modules@ngtoolswebpacksrcivyplugin.js:307:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
Error: ./src/polyfills.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: angularCompiler.getResourceDependencies(...) is not a function or its return value is not iterable
at getDependencies (C:Webvgcvgcnode_modules@ngtoolswebpacksrcivyplugin.js:261:56)
at C:Webvgcvgcnode_modules@ngtoolswebpacksrcivyplugin.js:374:20
at analyzingFileEmitter (C:Webvgcvgcnode_modules@ngtoolswebpacksrcivyplugin.js:307:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
任何想法如何解决这一问题?我真的在网上找不到任何相关的问题或解决方案。
回答
将 Angular CLI 从 10 升级到 11 对我有用。
ng update @angular/core @angular/cli
ng update