Angular-cli: Error: NGCC failed. at NgccProcessor.process

Created on 28 Oct 2020  Β·  4Comments  Β·  Source: angular/angular-cli

🐞 Bug report

Command (mark with an x)


  • [ ] new
  • [x] build
  • [x] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] extract-i18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Is this a regression?

I don't believe so, even though it has clearly happened before to people using earlier versions (eg. 9.0.3, 9.0.2)

I've looked at those earlier issues, and tried some of the solutions (see last section). One of them is to disable Ivy, which I have not tried, as that seems to be a workaround, not a solution.

Description

Running either ng server or ng build crashes:

An unhandled exception occurred: NGCC failed.

πŸ”¬ Minimal Reproduction

I'm not really sure how I can reproduce this. A new repo is clearly going to work since people are creating them every day. It seems to be an issue with the ng compiler itself, or some dependency it has.

-->

πŸ”₯ Exception or Error


Error: NGCC failed.
    at NgccProcessor.process (/Users/.../node_modules/@ngtools/webpack/src/ngcc_processor.js:119:19)
    at /Users/.../node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:590:31
    at SyncHook.eval [as call] (eval at create (/Users/.../node_modules/tapable/lib/HookCodeFactory.js:19:10), :9:1)
    at SyncHook.lazyCompileHook (/Users/r.../node_modules/tapable/lib/Hook.js:154:20)
    at Object.webpack [as webpackFactory] (/Users/.../node_modules/webpack/lib/webpack.js:55:30)
    at createWebpack (/Users/.../node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.js:21:36)
    at Object.runWebpackDevServer (/Users/.../node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.js:47:12)
    at SwitchMapSubscriber.project (/Users/.../node_modules/@angular-devkit/build-angular/src/dev-server/index.js:167:32)
    at SwitchMapSubscriber._next (/Users/.../node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/switchMap.js:47:27)
    at SwitchMapSubscriber.Subscriber.next (/Users/.../node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:66:18)
    at /Users/.../node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/util/subscribeToPromise.js:7:24
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

🌍 Your Environment


Your global Angular CLI version (9.1.4) is greater than your local
version (9.1.0). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.1.0
Node: 14.1.0
OS: darwin x64

Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, youtube-player
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.7
@angular-devkit/build-angular     0.1002.0
@angular-devkit/build-optimizer   0.1002.0
@angular-devkit/build-webpack     0.1002.0
@angular-devkit/core              9.1.0
@angular-devkit/schematics        9.1.0
@angular/cdk                      9.2.0
@angular/fire                     6.0.0
@angular/flex-layout              9.0.0-beta.29
@angular/material                 9.2.0
@ngtools/webpack                  10.2.0
@nguniversal/builders             9.1.0
@nguniversal/common               9.0.2
@nguniversal/express-engine       9.0.2
@schematics/angular               9.1.0
@schematics/update                0.901.0
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.44.1

Anything else relevant?
Not browser specific.

  1. I have tried node v12.4 and node 14.5 and receive the same error.
  2. I have tried nuking node_modules many times and npm i again.
  3. I have tried (2) followed by rebuild node-sass and rebuild node-gyp as a colleague had the same issue and that fixed it on his machine. This is ng version output:

angular version

I see differences in some of his dependencies compared to mine, but not sure a) how that occurred or b) how to make my environment match his [note he is on Windows, not Mac)

All 4 comments

Hi @rmcsharry,

From the ng version above it looks like you are using various packages which are not compatible together.

Example the below are not compatible with Angular and Angular CLI v9.

@angular-devkit/build-angular     0.1002.0
@angular-devkit/build-optimizer   0.1002.0
@angular-devkit/build-webpack     0.1002.0

Likely downgrading @angular-devkit/build-angular to ~0.901.7 should be enough.

Closing as this seems to be related to a mis-configuration in the users project.

@alan-agius4 Thanks for the fast response and analysis. Downgrading as suggested fixed the issue! You da man! πŸ‘

Glad to hear it was a simple fix πŸ˜€.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sysmat picture sysmat  Β·  3Comments

rajjejosefsson picture rajjejosefsson  Β·  3Comments

ericel picture ericel  Β·  3Comments

daBishMan picture daBishMan  Β·  3Comments

JanStureNielsen picture JanStureNielsen  Β·  3Comments