Call retries were exceeded exception while ng build
Asked Answered
C

11

76

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
Crossbreed answered 30/12, 2019 at 13:1 Comment(7)
In tsconfig.app.json if you have target: es2015 change it with target: es5Mutazilite
@MsuArven yes! changing from es2015 to es5 worked for me.Crossbreed
@Angular Can you please tell, why es2015 was causing this exception?Crossbreed
This worked for me. I just deleted node_modules/ and reinstalled.Myranda
its really work just remove node_modules and install again, its working fineCorrales
@TintinSansYeux if we want to use the differential loading we must set the target to es2015Copal
can anyone shed some light why this works with es5?Knitter
Z
68

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

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.

Zavala answered 1/1, 2020 at 19:41 Comment(6)
node --max_old_space_size=4096 did not worked for me. With 8GB it worked.Schonfeld
I was facing the same issue and it is fixed with above commad - node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng buildHoberthobey
only disabling differential loading worked for me :(Whichsoever
It can help if you remove compatibility with older browsers angular.io/guide/deployment#differential-loadingBolyard
changed to 2048 on my AWS instance with 2GB RAM – works!Wil
It has something to do with building the app with "es2015". Using the old target "es5" worked on my sideUnconnected
S
40

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

Salimeter answered 4/1, 2020 at 7:5 Comment(2)
But I need es2015, because es5 fails for @angular/fire 6.0.3 and other. github.com/angular/angularfire/issues/2521Bolyard
This is not a "solution", just a hack/patch that will have other negative side effectsSenna
R
9

Use

node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build
Recuperate answered 6/4, 2021 at 6:20 Comment(1)
This works like I charm. For any other beginner like me out there, you replace your build command in package.json with this.Edwardoedwards
D
5

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.

Dimidiate answered 6/4, 2021 at 11:25 Comment(1)
This is the current working solution. thanks!Haft
S
3

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.

Symphysis answered 7/10, 2020 at 11:6 Comment(0)
A
1

I have also met the same issue, by changing the angular/cli version to 8.3.19, the issue has been resolved.

Accrete answered 3/1, 2020 at 3:9 Comment(0)
T
0

This only applicable for those who have migrated their app to angular 10 and increasing memory also not helping

check your "typescript" and "@types/node" in package.json check whether they are compatible or not in https://www.npmjs.com/package/@types/node

try to downgrade @angular-devkit/build-angular below 0.8XX.X

Toothache answered 5/5, 2021 at 11:53 Comment(0)
D
0

I literally tried everything for days (multiple!) to fix this issue (without increasing the allowed RAM memory on the server, because I was already on the max allowed (shared hosting)). Nothing worked, except for -

--loglevel verbose

I was using it to see what was causing problems. But seems that it takes a lot of memory to show the full log in real-time. After removing this from my commands everything builds from the first try.

Deity answered 18/4, 2022 at 11:26 Comment(0)
L
0

Make sure you are not using older version of Node.

nvm use 16 or greater version works for me!

Lying answered 8/8, 2023 at 8:26 Comment(0)
G
-1

In my case I upgraded the version of node.

I was running v10.* and I upgraded to v12.20.1 and build was completed.

I use Node Version Manager: nvm for switching versions of node.

Garrulous answered 6/7, 2021 at 14:39 Comment(0)
E
-2

For react-natives, you can find this helpful.

npm  install --save-dev  escape-string-regexp
Eoin answered 1/9, 2021 at 10:52 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.