angular-cli: An unhandled exception while Generating ES5 bundles

🐞 Bug report

Command (mark with an x)

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

Is this a regression?

Yes, the previous version in which this bug was not present was 8.2.1, maybe 8.2.2

Description

When using ng build in circle ci, it throws an error (screenshot attached):

Generating ES5 bundles for differential loading...
An unhandled exception occurred: cancel after 1 retries!
Screen Shot 2019-08-31 at 12 42 29

🔬 Minimal Reproduction

Unfortunately, I cant provide a way to reproduce it as it happens only in CI and I am unable to get the logs. I think it’s related to the size of my app but I cant be sure.

🔥 Exception or Error


WARNING in budgets, maximum exceeded for initial. Budget 2 MB was exceeded by 2.2 MB.
Generating ES5 bundles for differential loading...
An unhandled exception occurred: cancel after 1 retries!
See "/tmp/ng-8Tr7C1/angular-errors.log" for further details.
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! frontend-mallabee@2.0.1 build-dev: `ng build --configuration dev`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the frontend-mallabee@2.0.1 build-dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2019-08-31T09_20_07_881Z-debug.log
Exited with code 1

🌍 Your Environment


@angular-devkit/architect         0.803.2
@angular-devkit/build-angular     0.803.2
@angular-devkit/build-optimizer   0.803.2
@angular-devkit/build-webpack     0.803.2
@angular-devkit/core              8.3.2
@angular-devkit/schematics        8.3.2
@angular/cdk                      8.1.4
@angular/cli                      8.3.2
@angular/flex-layout              8.0.0-beta.27
@angular/material                 8.1.4
@ngtools/webpack                  8.3.2
@schematics/angular               8.3.2
@schematics/update                0.803.2
rxjs                              6.5.2
typescript                        3.5.3
webpack                           4.39.2

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 36
  • Comments: 85 (14 by maintainers)

Commits related to this issue

Most upvoted comments

I was able to fix my build by for the moment changing the tsconfig.app.json target from es2015 back down to es5, this disabled differential loading.

See https://angular.io/guide/deployment#differential-loading

Hello. It happened to me after upgrading to angular/cli@8.3.21 and angular-devkit/build-angular@0.803.21. Going back to .20 “fixed” the issue.

I was able to fix my build by for the moment changing the tsconfig.app.json target from es2015 back down to es5, this disabled differential loading.

See https://angular.io/guide/deployment#differential-loading

Thanks it works for me

@alan-agius4 Maybe a good way to maintain it (sounds like a good way to improve performance locally) and provide a solution to CI environments with limited resources would be adding an option to angular.json or some other place to determine whether it should run multiple processes to parallelize ES5 bundles generation or not.

@Harika511 In package.json:

  "devDependencies": {
    "@angular-devkit/build-angular": "0.803.20",
    "@angular/cli": "8.3.20",

Note missing “~” or “^” characters.

Fixed - But needs verification.

@jimmykane Reverting to these versions helps me

"@angular-devkit/build-angular": "~0.802.2",
"@angular/cli": "~8.2.2"

I guess this is related (or even the same): #16515

ng update @angular/cli (updated to 8.3.13) appears to have solved this issue for me

i use angular 8.2.10, install latest nodejs solved my problem. no need to change anything 😃

@Harika511 In package.json:

  "devDependencies": {
    "@angular-devkit/build-angular": "0.803.20",
    "@angular/cli": "8.3.20",

This worked for me also. I also noticed that removing any modules that referenced “ngx-bootstrap” caused the problem to go away.

I use angular 8.2.10, upgrade nodejs to v12.14.0 solved my problem.

Definetely started hanging on differential loading for me after I ran npm audit fix yesterday, which updated @angular-devkit/build-angular from ^0.802.2 to ^0.803.21. If I roll back to 0.802.2 I can build again. Even 0.803.0 doesn’t work.

The latest releases of the CLI contain a variety of improvements to mitigate potential memory issues. However, as Node.js has a default memory limit of 2GB per process, very large projects may still need to increase the memory value for the Node.js process. This can be accomplished via a command similar too the following: node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build Note the 4096 value essentially represents a maximum memory usage value for the node process in megabytes. For this example, that would be 4GB of memory. Ensure that the system has enough physical memory to support the value chosen.

It is also recommended to use the latest version of Node 12 (currently 12.13.0) as this contains important improvements related to memory usage.

Angular CLI: 9.0.0-next.12
Node: 10.16.3
OS: darwin x64
Angular: 9.0.0-next.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, upgrade

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-next.11
@angular-devkit/build-angular     0.900.0-next.11
@angular-devkit/build-optimizer   0.900.0-next.11
@angular-devkit/build-webpack     0.900.0-next.11
@angular-devkit/core              9.0.0-next.12
@angular-devkit/schematics        9.0.0-next.12
@angular/cdk                      9.0.0-next.0
@angular/cli                      9.0.0-next.12
@ngtools/webpack                  9.0.0-next.11
@schematics/angular               9.0.0-next.12
@schematics/update                0.900.0-next.12
rxjs                              6.5.3
typescript                        3.6.4
webpack                           4.41.1

I get the same error in small/medium sized project with the config above.

Generating ES5 bundles for differential loading...
An unhandled exception occurred: Call retries were exceeded

The node process memory usage grows until it crashes at 1.4xGb and then it starts all over again for some time.

The number of affected users seems to be quite high, in the end. Any news from the dev team ? Have you been able to precisely identify the issue ?

I accidentally stumbled upon this thread. In my case CircleCI was failing because of displaying too much progress in the build step. A small change by running ng build --no-progress helped.

Hello. It happened to me after upgrading to angular/cli@8.3.21 and angular-devkit/build-angular@0.803.21. Going back to .20 “fixed” the issue._

thnx mate, this worked for me.

Hi bdiriamine,

I had so so so much errors and ionic cordova build --release android nothing helped… IONIC Should know (I am using IONIC 5) for the Mobile app to release something hassle free… Your Answer saved me from two days Work… Thank you so so so much. The Built the APP as you said.

ionic cordova run android --prod

Happy New year Cheers.

Thank you

I tried the latest version again: ng update @angular/cli @angular/core --next but I still get the same error. The good thing is that now it produces some logs and the only thing I can understand from there is that it throws an out of memory exception, at about 2Gb of memory used. How can I help?

Simply upgrading my Mac Mini Bamboo CI server from Node 10 -> Node 12.10 fixed my builds (cli 8.3.14)

Adding this to my package.json solved for me:

"browserslist" : [
    ],

@clydin here is a repo https://github.com/jimmykane/quantified-self/ you can try to do a beta build and it will fail

Seeing the full stacktrace it might be a resource problem since CIRCLE CI will have limited resources If you are using the free plan the resources are 2CPU and 4096MB.