Angular 9 - NGCC fails with an unhandled exception

后端 未结 16 1509
离开以前
离开以前 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:18
    • I removed tslib.js from package.json
    • Removed package-lock.json
    • Deleted node_modules folder
    • npm i
    • ng serve

    Worked for me

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

    In my particular case the @angular-devkit/build-angular was updated to "^0.1001.2" in my package.json after running the npm audit fix. (This version seems to belong to angular 10, instead of the local projects' angular version (v9.1.7))

    After reverting this change, everything started working again :

    "@angular-devkit/build-angular": "~0.901.6"

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

    Well in my case I was trying to run an angular project of an older version with a newer version of node. I did this:

    Removes all the existing nodule modules.

    rm -rf node_modules
    

    update node js to latest

    npm update
    npm install
    

    updates the angular project version to the latest

    ng update @angular/core
    

    updates the project cli to the latest

    ng update @angular/cli
    

    Now start the project

    ng-serve
    
    0 讨论(0)
  • 2020-12-24 06:25

    I had to go into my tsconfig.spec.json file and add

    "angularCompilerOptions": {
        "enableIvy": false
    }
    

    It was already in my tsconfig.json file.

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

    Using terminal/cmd,

    1st Step: ng update @angular/cli @angular/core

    2nd Step: ng update

    3rd Step: ng serve

    Fixed mine.

    NOTE Your custom css files in bootstrap folder might get deleted. Back them up before and place them back after the update!

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

    Try to remove the node_modules folder and run install again:

    rm -rf node_modules
    
    npm install
    

    For me it has solved the problem.

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