【发布时间】:2021-08-02 08:39:24
【问题描述】:
我今天运行了一个 Angular 项目,它告诉我它有很多低漏洞和一些高漏洞。所以我输入: *ng 更新 @angular/core @angular/cli *ng 更新
但是现在当我尝试运行它时,它给了我这些错误:
Error: ./src/main.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: angularCompiler.getDiagnosticsForFile is not a function
at C:\.....\Angular\node_modules\@ngtools\webpack\src\ivy\plugin.js:384:60
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: ./src/polyfills.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: angularCompiler.getDiagnosticsForFile is not a function
at C:\.....\Angular\node_modules\@ngtools\webpack\src\ivy\plugin.js:384:60
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: (webpack)-dev-server/client?http://0.0.0.0:0&sockPath=/sockjs-node
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: angularCompiler.getDiagnosticsForFile is not a function
at C:\....\Angular\node_modules\@ngtools\webpack\src\ivy\plugin.js:384:60
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: ./src/main.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: angularCompiler.getDiagnosticsForFile is not a function
at C:\.....\Angular\node_modules\@ngtools\webpack\src\ivy\plugin.js:384:60
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: ./src/polyfills.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
TypeError: angularCompiler.getDiagnosticsForFile is not a function
at C:\......\Angular\node_modules\@ngtools\webpack\src\ivy\plugin.js:384:60
at processTicksAndRejections (internal/process/task_queues.js:93:5)
【问题讨论】:
-
你有没有尝试过这个question的其他解决方案,即删除node_modules并重新安装和构建
-
是的,我试过了,但没用
-
您基本上是带有
ng update命令的角度版本。您应该遵循他们的官方指南来更新 Angular 版本。 update.angular.io
标签: angular typescript webpack