NGCC failed. at NgccProcessor.process ( Angular\node_modules\@ngtools\webpack\src\ngcc_processor.js:139:19)

Viewed 1836

I have upgraded My Angular CLI project from 8 to 9.

Here are the current Angular CLI and other package versions:

Angular CLI: 9.1.15
Node: 14.17.0
OS: win32 x64

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

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1202.1
@angular-devkit/build-angular     12.2.1
@angular-devkit/build-optimizer   0.1202.1
@angular-devkit/build-webpack     0.1202.1
@angular-devkit/core              9.1.15
@angular-devkit/schematics        9.1.15
@angular/cdk                      8.2.3
@angular/cli                      9.1.15
@ngtools/webpack                  12.2.1
@schematics/angular               9.1.15
@schematics/update                0.901.15
rxjs                              6.6.7
typescript                        3.8.3
webpack                           5.50.0

I am receiving this below-given error when I am compiling the project.

Generating browser application bundles (phase: setup)...Options:
      --version                          Show version number           [boolean]
  -s, --source                           A path (relative to the working
                                         directory) of the `node_modules` folder
                                         to process. [default: "./node_modules"]
  -p, --properties                       An array of names of properties in
                                         package.json to compile (e.g. `module`
                                         or `es2015`)
                                         Each of these properties should hold
                                         the path to a bundle-format.
                                         If provided, only the specified
                                         properties are considered for
                                         processing.
                                         If not provided, all the supported
                                         format properties (e.g. fesm2015,
                                         fesm5, es2015, esm2015, esm5, main,
                                         module) in the package.json are
                                         considered.
                                         .......
                                         .......


Unknown arguments: use-program-dependencies, useProgramDependencies
C:\Users\x\Angular\node_modules\@ngtools\webpack\src\ngcc_processor.js:139
            throw new Error(errorMessage + `NGCC failed${errorMessage ? ', see above' : ''}.`);

Error: NGCC failed.
    at NgccProcessor.process (C:\Users\x\Angular\node_modules\@ngtools\webpack\src\ngcc_processor.js:139:19)
    at C:\Users\x\Angular\node_modules\@ngtools\webpack\src\ivy\plugin.js:129:27

Can some guide me how I can resolve this issue?

2 Answers

Run this command npm i @ngtools/webpack and after @ mention which version you want, same as your Angular version.

npm i @ngtools/webpack@9.1.15

whatever version of Angular you are using choose the same version.

Version              Downloads (Last 7 Days)             Tag
12.2.14                           101,188               v12-lts
8.3.29                             60,775               v8-lts
9.1.15                             57,568               v9-lts
7.3.10                             34,584               v7-lts

you can find all packages here @ngtools/webpack

I had similar issue with Angular 12 and Node 17.4.0. I changed Node to v16.13.2 and now it works fine.

Related