CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory ionic 3 Build prod Issue


#1

Hello,
Currently I am trying to build my ionic project to android apk file but I ran into CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory issue when in hit ionic cordova build android --prod --release. I googled and tried many fixes no luck

tries this not working

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\..\@ionic\app-scripts\bin\ionic-app-scripts.js" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node --max_old_space_size=4096  "%~dp0\..\@ionic\app-scripts\bin\ionic-app-scripts.js" %*
)

also tried all the ans mention in this question Error in ionic cordova build android --prod. But no luck Please help

Ionic Info

ionic_info

Error
error


CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory ionic 3 Mac issue ipa
#2

Have you try --max-old-space-size ?

https://github.com/ionic-team/ionic-app-scripts/issues/1036 or https://github.com/ionic-team/ionic-cli/issues/1453


#3

Hello this works for me.

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe" --max_old_space_size=8048 "%~dp0\node_modules\ionic\bin\ionic" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node --max_old_space_size=8048 "%~dp0\node_modules\ionic\bin\ionic" %*
)

#4

Its not working. Please Help Thannks


#5

Have you try upgrading node and npm?


#6

No, I have not updated my node & npm. Will do it as last option if nothing works out.


#7

Hello,

error message is still the same? You have this included to your ionic.cmd and restarted?

Maybe a cache clean helps?

Since node 8? should be a option for old-max-space. I’m on node 6.x, so I never tried this.

Before you install npm new, it is maybe worth to take a look to nvm. nvm (nvm-windows) can switch between node versions.

Good luck, and best regards, anna-liebt


#8

Yes the error is still their. I have modified ionic.cmd many times. And Restarted the whole process but no luck.

“Maybe a cache clean helps?”
How can I do this?

“Before you install npm new, it is maybe worth to take a look to nvm. nvm (nvm-windows) can switch between node versions.”

Sorry nvm, I did not understand.

THanks for your response.


#9

Please let me know How can I upgrade node & npm. I am on window 10. I googled and tried few things but no luck on upgading. May be I have misunderstood the concept. Please help;


#10

I don’t use windows so can’t tell you exactly. But I guess you could just download and install Node https://nodejs.org/en/

Alternatively you could use n https://github.com/tj/n

Npm comes with node but if you want to update it after you have installed the last version of node you could run

 npm install -g npm@latest

Finally, important, after having installed node don’t forget to delete your node_modules and reinstall it


#11

Hello,

make sure that the code is really the same. I have a simillar configuration and have the same problem solved with this.

nvm is a node version manager. https://github.com/coreybutler/nvm-windows

It makes easier switching between node versions on the same machine. Maybe for testing new node version. This did not solve your problem, but it is a comfort feature. So maybe you have on node 8? better luck setting the node option, but with nvm you can easier get back to an other installed node version.

Maybe it is worth to take a little bit more google search, because this problem seems that more people have.

Best regards, anna-liebt


#12

https://www.youtube.com/watch?v=4RANLBwZptQ. I followed this video as an alternative way to my published my app in google play store. If any one find this, it will be help full for that. thanks for your continuous support anna. I really appreciate it.


#13

Congrats for your release!

But may I ask, how come? The video you linked display how to sign your apk and the error you posted has to do with heap size, what’s the relation?


#14

Hello reedrichards,
thanks for your concern, I have updated my ans. I used the video as an alternative coz I got stuck with the “CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory” problem. I will keep on trying to run ionic cordova build android --prod --release in coming days and will try to fix this issue.
Appreciate it.


#15

Ok I see, so actually you still face the same issue…good luck then!


#16

Thanks. Will try my best to solve this issue. Working in it.