TypeError: angularCompiler.getResourceDependencies(…) is not a function or its return value is not iterable

How To Solve TypeError: angularCompiler.getResourceDependencies(…) is not a function or its return value is not iterable error.

Here is I am Adding All Possible solutions that I have tried to Solve This Error. Without wasting your time, Let’s start this article.

How To Solve TypeError: angularCompiler.getResourceDependencies(…) is not a function or its return value is not iterable

When I Ran my angular project that run on 10.0.1. 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)

here is I am Adding All Possible solutions that I have tried to Solve This Error. So without wasting your time lets start this solution.

Solutions

How to solve TypeError: angularCompiler.getResourceDependencies(…) is Not a Function or Its return value is not iterable ?

Updating to angular 11 is Solved my issue. So We just have to update our Angular Version to latest. This Solution Worked for me.

Solution 1

Updating to Angular 11 is Solved my issue. We just have to update our Angular Version to latest. This Solution Worked for me.

  1. ng update @angular/core @angular/cli
  2. ng update
  3. this both command will update angular to latest version.
  4. Its work from me

Solution 2

You can Also Run below Command to solve this Error. TRY this one. This Solution Might work for you. This Solution also Worked for me as well.

  1. rm -rf node_modules/
  2. npm install
  3. npm run build

Solution 3

This Solution Might work for you. Try This Solution

rmdir /s node_modules
npm install "or" npm install @angular-devkit/build-angular
npm run build

Summery

So it’s all About All possible solutions. Hope this above all solution helped you a lot. Comment below Your thoughts and your queries. Comment Below on your suggestion.

Also Read

Leave a Comment