Angular 13 >=13.0.3 ng serve throws UnhandledPromiseRejectionWarning: Error: NGCC failed.
See original GitHub issue🐞 Bug report
Command (mark with an x
)
- new
- build
- [ x] serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
It seems to be a regression as when we first updated our project to Angular 13, it didn’t happen. FIxed all @angular/* versions to 13.0.2 and stopped getting the error. Tried it myself and with a couple of coworkers. Same problem.
Description
npm run ng serve
[... some other logs ...]
[... exception on exception section]
[.. command stuck on '⠹ Generating browser application bundles (phase: setup)...' ]
🔬 Minimal Reproduction
NX monorepo once working with Angular 12 migrated to Angular 13, package.json installed version 13.0.1. Recently had to delete the node_modules and npm install again. npm installed version 13.0.3
🔥 Exception or Error
(node:24753) UnhandledPromiseRejectionWarning: Error: NGCC failed.
at NgccProcessor.process (/home/buru/Eze/queplancl/node_modules/@ngtools/webpack/src/ngcc_processor.js:146:19)
at /home/buru/Eze/queplancl/node_modules/@ngtools/webpack/src/ivy/plugin.js:141:27
at Hook.eval [as call] (eval at create (/home/buru/Eze/queplancl/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:24:1)
at Hook.CALL_DELEGATE [as _call] (/home/buru/Eze/queplancl/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (/home/buru/Eze/queplancl/node_modules/webpack/lib/Compiler.js:1054:30)
at /home/buru/Eze/queplancl/node_modules/webpack/lib/Compiler.js:1099:29
at eval (eval at create (/home/buru/Eze/queplancl/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:24753) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
🌍 Your Environment
› ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 13.0.3
Node: 14.17.4
Package Manager: npm 6.14.14
OS: darwin x64
Angular: 13.0.3
... animations, cdk, cli, common, compiler, compiler-cli, core
... elements, forms, language-service, localize, material
... platform-browser, platform-browser-dynamic, router
... service-worker
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1300.2
@angular-devkit/build-angular 13.0.3
@angular-devkit/core 13.0.3
@angular-devkit/schematics 13.0.3
@angular/flex-layout 12.0.0-beta.35
@schematics/angular 10.2.3
ng-packagr 13.0.8
rxjs 7.4.0
typescript 4.4.4
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Upgrade to Angular 13 : Error - NGCC failed - Stack Overflow
I've got this error: Unknown arguments: use-program-dependencies, useProgramDependencies An unhandled exception occurred: NGCC failed.
Read more >error: failed to initialize angular compilation - ngcc failed.
Angular 9 - NGCC fails with an unhandled exception ... This error may be because two or more entry-points overlap and ngcc has...
Read more >An unhandled exception occurred NGCC failed 2020 - YouTube
Dear Allafter Uninstall angular font-awesome from the package.json, kindly close the package.json opened file then restart the server ex: ng ...
Read more >help with webpack error : r/Angular2 - Reddit
When i switched back over to the web branch and ran ng serve I got this ... throw new Error(errorMessage + `NGCC failed${errorMessage...
Read more >why is the error NGCC failed during ng serve Code Example
ng serve NGCC failed. [error] Error: NGCC failed. ... An unhandled exception occurred: NGCC failed. See "/tmp/ng-fPmbKz/angular-errors.log" for further details.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jsanta sorry for late reply I had same issue with 13.1.1 ngcc was failing due to incompatible version of a npm package Solution navigate to NodeModule -> @angular -> compiler-cli -> bundles -> chunk-KWZNY2SK.js now find the function
extractFactoryCallsFromIfStatement(node)
In that function, paste the following codeconsole.log(currentNode.thenStatement.getSourceFile());
before the following codethrow new Error("Then-statement inside UMD wrapper is not an expression statement:\n" + currentNode.thenStatement.getText());
so then you will have the information about the package in console that causing the issue, then update that package on the version which supports angular Ivy engine.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.