Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errors after npm audit fix angular 10.0.1

I ran this older 10.0.1 angular project today, and it told me it had a lot of low vulnerabilities and a few high ones. so i ran npm audit fix to fix them. 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.getResourceDependencies(...) is not a function or its return value is not iterable
    at getDependencies (C:\Web\vgc\vgc\node_modules\@ngtools\webpack\src\ivy\plugin.js:261:56)
    at C:\Web\vgc\vgc\node_modules\@ngtools\webpack\src\ivy\plugin.js:374:20
    at analyzingFileEmitter (C:\Web\vgc\vgc\node_modules\@ngtools\webpack\src\ivy\plugin.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:\Web\vgc\vgc\node_modules\@ngtools\webpack\src\ivy\plugin.js:261:56)
    at C:\Web\vgc\vgc\node_modules\@ngtools\webpack\src\ivy\plugin.js:374:20
    at analyzingFileEmitter (C:\Web\vgc\vgc\node_modules\@ngtools\webpack\src\ivy\plugin.js:307:20)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Any ideas how to fix this? I couldn't really find any relatable problems or solutions online.

like image 267
RTman Avatar asked Jan 22 '21 16:01

RTman


People also ask

How do I reverse npm audit fix?

Just revert the commit (or reset if you didn't commit it) and run npm ci again? If you have checked out your files from git or downloaded your project, you just need to revert package-lock. json to the previous state. Run npm install and you're good to go.

Should I always run npm audit fix?

If no security vulnerabilities are found, this means that packages with known vulnerabilities were not found in your package dependency tree. Since the advisory database can be updated at any time, we recommend regularly running npm audit manually, or adding npm audit to your continuous integration process.


4 Answers

Upgrading the Angular CLI from 10 to 11 works for me.

ng update @angular/core @angular/cli
ng update
like image 91
Пазюк Олександр Avatar answered Oct 10 '22 14:10

Пазюк Олександр


TRY this one

rm -rf node_modules/
npm install
npm run build
like image 36
Darshan Malani Avatar answered Oct 10 '22 14:10

Darshan Malani


I have also fixed the same issue. The main reason was the "@angular-devkit/build-angular" version which is not matching in my case. I changed it's version compatible angular version. In my case I am using angular 10 and previously the version started with "0.11" and I changed it to "0.1002.3".

like image 2
msucil Avatar answered Oct 10 '22 14:10

msucil


Try this:

rmdir /s node_modules
npm install "or" npm install @angular-devkit/build-angular
npm run build
like image 1
user15276771 Avatar answered Oct 10 '22 16:10

user15276771