Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular ng serve produces Error: NGCC failed

After running ng serve I've got an exception in terminal window:

Compiling @angular/core : module as esm5

Error: Error on worker #1: TypeError: Cannot read property 'map' of undefined

and message below:

An unhandled exception occurred: NGCC failed.

See /tmp/ng-EAdxWj/angular-errors.log for further details.

angular-errors.log:

[error] Error: NGCC failed.
    at NgccProcessor.process (/IdeaProjects/app/frontend/node_modules/@ngtools/webpack/src/ngcc_processor.js:76:19)
    at /IdeaProjects/app/frontend/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:579:31
    at SyncHook.eval [as call] (eval at create (/IdeaProjects/app/frontend/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
    at SyncHook.lazyCompileHook (/IdeaProjects/app/frontend/node_modules/tapable/lib/Hook.js:154:20)
    at Object.webpack [as webpackFactory] (/IdeaProjects/app/frontend/node_modules/webpack/lib/webpack.js:55:30)
    at createWebpack (/IdeaProjects/app/frontend/node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.js:20:36)
    at Object.runWebpackDevServer (/IdeaProjects/app/frontend/node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.js:46:12)
    at SwitchMapSubscriber.project (/IdeaProjects/app/frontend/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:191:32)
    at SwitchMapSubscriber._next (/IdeaProjects/app/frontend/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/switchMap.js:49:27)
    at SwitchMapSubscriber.Subscriber.next (/IdeaProjects/app/frontend/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:66:18)
    at /IdeaProjects/app/frontend/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/util/subscribeToPromise.js:7:24
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
like image 900
Serhii Avatar asked May 13 '20 08:05

Serhii


2 Answers

In my particular case the @angular-devkit/build-angular was updated to "^0.1002.0" 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.3))

After reverting this change, everything started working again :

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

like image 70
Rahul Chandra Avatar answered Sep 19 '22 13:09

Rahul Chandra


I had the error:

Unknown arguments: use-program-dependencies, useProgramDependencies
An unhandled exception occurred: NGCC failed.
See "C:\...\angular-errors.log" for further details.

I just updated angular cli, material and core, and other modules needed to my project, then updated npm and typescript package, and that's all.

ng update @angular/cli @angular/core
npm update @angular/material @angular/cdk
npm install -g typescript@latest
like image 20
Aldair Zepeda Avatar answered Sep 19 '22 13:09

Aldair Zepeda