Angular 9 - NGCC fails with an unhandled exception

后端 未结 16 1512
离开以前
离开以前 2020-12-24 05:40

Buidling the application after having upgraded dependcies to Angular 9 (and having performed necessary code changes) throws an error:

Compiling @ang

相关标签:
16条回答
  • 2020-12-24 06:28

    I had a similar problem,

    in my case updating NodeJS to new version helped.

    0 讨论(0)
  • 2020-12-24 06:29

    In my case I installed angular-font-awesome package from npm and then bootstrap, it might got conflicted, I just remove previously installed angular-font-awesome and then done ng build

    0 讨论(0)
  • 2020-12-24 06:29

    I had this issue when I ran ionic build while the project built just fine with my colleagues. So we ran ng -v to compare our packages. Turns out I had higher versions of @angular-devkit/build-angular, @angular-devkit/build-optimizer and @angular-devkit/build-webpack , each of them was version 0.1001.2 - our project was running with 0.901.8.

    So I ran npm uninstall @angular-devkit/build-angular 0.1001.2 to uninstall it, and npm install @angular-devkit/build-angular 0.901.8 to downgrade. On running ng -v again, the other 2 had downgraded as well.

    Finally, ionic build was a success! We lived happily thereafter, till we run into different problems.Working packages for our project

    0 讨论(0)
  • 2020-12-24 06:35

    I generally advise people to make a manual backup of the project after every succeded deployment (locally) because, when you face this kind of problem (everything related to NGCC errors) you can just hard delete node_modules folder and restore it from you last backup. and then build again.

    Sometimes, when you cannot afford updating nodeJS to the last version, this solution would be perfect.

    0 讨论(0)
  • 2020-12-24 06:36

    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)
    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. have installed the packages: (executing npm i )
    5. 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.

    0 讨论(0)
  • 2020-12-24 06:40

    in case version mismatch.. check first version node js and angular js

    then write : npm install => : ng serve

    if have port issue : ng server --port 4201

    0 讨论(0)
提交回复
热议问题