I'm using angular 11.2 in my machine and I want to run a angular 12 project. After clone from git, I ran below commands.

  1. npm install
  2. ng serve

But I got below errors and can't run the project. I read this question but it not worked for me.

Error: ./src/main.ts Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): TypeError: angularCompiler.getNextProgram is not a function at C:\Users\thimira_p\Desktop\itrd\epic-itrda-web\node_modules\@ngtools\webpack\src\ivy\plugin.js:376:100 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.getNextProgram is not a function at C:\Users\thimira_p\Desktop\itrd\epic-itrda-web\node_modules\@ngtools\webpack\src\ivy\plugin.js:376:100 at processTicksAndRejections (internal/process/task_queues.js:93:5) Error: (webpack)-dev-server/client? Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): TypeError: angularCompiler.getNextProgram is not a function at C:\Users\thimira_p\Desktop\itrd\epic-itrda-web\node_modules\@ngtools\webpack\src\ivy\plugin.js:376:100 at processTicksAndRejections (internal/process/task_queues.js:93:5) 

How to fix this issue?

6

5 Answers

I had the same problem in an Angular app which uses a custom webpack.config - having @angular-builders/custom-webpack as a dependency.

Angular and @angular-builders major versions should match.

Solved by updating @angular-builders/custom-webpack to the latest version:

npm install @angular-builders/custom-webpack@^12.0.0


If, after doing the installation, you get an error like: An unhandled exception occurred: Cannot find module 'webpack', try removing package-lock.json and node_modules and doing a clean install.


Github issue:

0

Upgrade from @angular-devkit/build-angular@0.1100 to @angular-devkit/build-angular@12

Try to remove

"aot": true

from angular.json

2

I'm still seen this error on @angular/core@12.0.3

The simple solution is to upgrade @angular-devkit/ to @angular-devkit/build-angular@12.0.3.

The main point is to replace @angular-devkit/ with @angular-devkit/build-angular@whatever_version_of_angular_you_have_installed in package.json. After that delete "node_modules" folder and do "npm install"

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", }

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy