Call retries were exceeded exception while ng build
Solution 1
Update 10.02.2019
This was a problem of the @angular/cli
. Updating the version to >= 8.3.22
should fix the issue: see this comment in #16515
ORIGINAL
Basically the build process is running out of memory: see related angular-cli issues #15493, #16515
The recommended remedy is to:
- update node to the latest version e.g.
12.14.0
-
increase the memory for the build process:
- in your
package.json
change the"build"
script to:node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build
- in this case the memory is increased to
4GB
depending on the size of your project you may need more
- in your
As a quick workaround it could also work to use older versions of angular/cli
and build-angular
:
"devDependencies": {
"@angular-devkit/build-angular": "0.803.20",
"@angular/cli": "8.3.20",
Another workaround is to disable differential-loading (i.e. skip generation of ES5 bundles), if you want this. Then the build-process will need less memory and may work.
Solution 2
For me editing tsconfig.json resolved my problem.
There was a change in @angular-devkit/build-angular which updated the differential loading. To fix this in your Ionic project, change the target value from “es2015” to “es5” in your tsconfig.json
For more details :- https://forum.ionicframework.com/t/ionic-cordova-build-get-stuck-at-generating-es5-bundles-for-differential-loading/180202/4
Solution 3
Use
node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build
Solution 4
I ran into a similar issue a few days ago.
I was using Node v10 and could only avoid the exceptions during production build by changing to "target": "es5" in tsconfig.json. This removed differential loading, which was undesireable.
However, after updating to Node v14, I no longer get the exceptions and am able to use "target": "es2015" again.
Solution 5
The proposed workarounds above did work for me but there is now a much more elegant solution, tested for Angular9 and above.
No need to mess around manually with the JS heap allocation anymore (node --max_old_space_size=4096
...), which most of us are not comfortable with.
The solution is just to add "sideEffects": false
to your package.json file.
I found this awesome solution on the official Angular GitHub issues page here and it works smoothly for me.
Savan Gadhiya
Updated on July 05, 2022Comments
-
Savan Gadhiya almost 2 years
I am facing an exception while
ng build
(generating ES5 bundles for differential loading...)An unhandled exception occured: Call retires were exceeded
Used versions:
- Angular-CLI:
8.3.20
- Angular:
8.2.7
- Node:
12.12.1
Also in logs, it is mentioned
[error] Error: Call retries were exceeded at ChildProcessWorker.initialize
- Angular-CLI:
-
Jonas Marty over 4 years
node --max_old_space_size=4096
did not worked for me. With 8GB it worked. -
purnima kamble over 4 yearsI was facing the same issue and it is fixed with above commad - node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build
-
Obay Abd-Algader almost 4 yearsonly disabling
differential loading
worked for me :( -
nelson6e65 over 3 yearsBut I need es2015, because es5 fails for @angular/fire 6.0.3 and other. github.com/angular/angularfire/issues/2521
-
nelson6e65 over 3 yearsIt can help if you remove compatibility with older browsers angular.io/guide/deployment#differential-loading
-
Serhii Topolnytskyi over 3 yearschanged to 2048 on my AWS instance with 2GB RAM – works!
-
Richard about 3 yearsThis is not a "solution", just a hack/patch that will have other negative side effects
-
Zdravko Kolev about 3 yearsIt has something to do with building the app with "es2015". Using the old target "es5" worked on my side
-
Suyog almost 3 yearsThis works like I charm. For any other beginner like me out there, you replace your build command in package.json with this.
-
stoneshishang about 2 yearsThis is the current working solution. thanks!