Friday, 20 August 2021

Angular 7,8,9 - NGCC fails with an unhandled exception

https://stackoverflow.com/questions/61222467/angular-9-ngcc-fails-with-an-unhandled-exception

 Compiling @angular/core : es2015 as esm2015 An unhandled exception occurred: NGCC failed.


This problem (NGCC failed) was encountered by me and my colleague developer on our localhost machines.

It would be important to remark that the dev and prod machines were running well.

In order to solve this problem we've followed the next steps:

  1. in tsconfig.json, in angularCompilerOptions have set ("enableIvy": false) [Not Recommneded, will cause bigger node_modules)
  2. updated the nodeJS to the last version: (executing node -v returned v14.3.0)
  3. have deleted the node_modules folder: (executing "rm .\node_modules\" [on windows], make sure it has been deleted successfully)
  4. delete package-lock.json
  5. have installed the packages: (executing npm i )
  6. here the project is ready to be built. It builds and runs without errors now.

I wish this helps you and other people in situations like this.

No comments:

Post a Comment