angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

An unhandled exception while Generating ES5 bundles

Open ronfogel opened this issue 7 years ago • 85 comments

🐞 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! [email protected] build-dev: `ng build --configuration dev`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] 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

ronfogel avatar Aug 31 '19 09:08 ronfogel

In our case, we are only supporting modern browsers and using Angular 9, so what worked for me is modifying the browserlist file to only have Chrome >= 61. See this SO answer.

Edit: I wanted to ensure that down the road other browsers were also considered so I modified my browserlist like so:

last 2 Chrome versions
last 2 ChromeAndroid versions
last 2 Safari versions
last 2 iOS versions
last 2 Firefox versions
last 2 FirefoxAndroid versions
last 2 Edge versions

neil-119 avatar Nov 25 '19 19:11 neil-119

@clydin and @vikerman this is still failing for me with a large project I have 6656 for memory on the node process and my project is currently using v9.0.0-rc.6 so I believe your fixes should be visible yet it's still failing the same way. I've attached one of the stack traces in case that helps. Stacktrace gist

paullryan avatar Dec 16 '19 22:12 paullryan

@paullryan Can you open a new issue describing the problem you are encountering? If possible please include the full output of ng version, the build command used, the relevant sections of the configuration file for the used build command (build options & configuration options), and also the console output of the build command with different loading disabled. You should be able to use a temporary browserslist file with only Chrome 75 for the later.

clydin avatar Dec 17 '19 00:12 clydin

@clydin I realized it was because the prod flag was not being recognized by the build system that was failing so sorry for the the false alarm, thanks for the response but no need for a new issue.

paullryan avatar Dec 19 '19 19:12 paullryan

Adding this to my package.json solved for me:

"browserslist" : [
    ],

This worked in conjunction with removing the file browserslist

planet4us avatar Dec 20 '19 06:12 planet4us

Hello. It happened to me after upgrading to angular/[email protected] and angular-devkit/[email protected]. Going back to .20 "fixed" the issue.

robelcik avatar Dec 20 '19 09:12 robelcik

Hello. It happened to me after upgrading to angular/[email protected] and angular-devkit/[email protected]. Going back to .20 "fixed" the issue. How to go back to .20. please clarify me

Harika511 avatar Dec 20 '19 09:12 Harika511

@Harika511 In package.json:

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

Note missing "~" or "^" characters.

robelcik avatar Dec 20 '19 09:12 robelcik

@robelcik many many thanks

strogof avatar Dec 20 '19 16:12 strogof

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.

schnucks-rrphillips avatar Dec 20 '19 17:12 schnucks-rrphillips

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

mokth avatar Dec 23 '19 16:12 mokth

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

jaime-alex avatar Dec 23 '19 18:12 jaime-alex

run cmd ionic cordova run android --prod should work .. have a good day ;)

bdiriamine avatar Dec 25 '19 10:12 bdiriamine

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

ishfaak avatar Dec 26 '19 08:12 ishfaak

@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.

PercentageCorporation avatar Dec 27 '19 04:12 PercentageCorporation

Hello. It happened to me after upgrading to angular/[email protected] and angular-devkit/[email protected]. Going back to .20 "fixed" the issue._

thnx mate, this worked for me.

SkanderEchaoui avatar Dec 30 '19 09:12 SkanderEchaoui

  • using newest node version (12.14.0) didn't work for me
  • solution for now is to go back to old dev-deps:
"devDependencies": {
    "@angular-devkit/build-angular": "0.803.20",
    "@angular/cli": "8.3.20",
  • increasing the memory node --max_old_space_size=12000 also works as a workaround

tmtron avatar Jan 01 '20 18:01 tmtron

Updating node to 12.14.0 worked for me with the latest build-angular and cli packages. Thanks.

schnucks-rrphillips avatar Jan 02 '20 14:01 schnucks-rrphillips

After updating to 8.3.21, I also have this issue but only for non production issues. When building with ng build --prod , node doesn't run out of memory. (Using node v12.14.0)

pkarakal avatar Jan 03 '20 14:01 pkarakal

Same issue for me. Can we get this issue reopened or is there another issue tracking it? This must be affecting most users.

rocts avatar Jan 06 '20 20:01 rocts