0

I ran an angular project today, and it told me it had a lot of low vulnerabilities and a few high ones. so I typed: *ng update @angular/core @angular/cli *ng update

but now when I try to run it, it gives me these errors:

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)
  • Have you tried the other solutions to this [question](https://stackoverflow.com/questions/65849026/errors-after-npm-audit-fix-angular-10-0-1), namely deleting node_modules and reinstalling and building – Andrew Allen May 12 '21 at 00:37
  • yes I tried but it didn't work – Oussama737 May 12 '21 at 00:38
  • You are basically your angular version with `ng update` command. You should follow their official guidelines to update angular version. https://update.angular.io/ – Mir entafaz Ali May 12 '21 at 05:42

1 Answers1

0

I upgraded my app to Angular 11 and had same build errors. This issue fixed for me when I downgraded below package in package.json file.

From:

"devDependencies": {
"@angular-devkit/build-angular": "~0.1102.17",
}

To:

"devDependencies": {
"@angular-devkit/build-angular": "~0.1100.2",
}

Chirag
  • 1,683
  • 2
  • 17
  • 26