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](https://global.discourse-cdn.com/ionicframework/original/3X/b/a/ba350f226e6bebf21d643662e9e78f53988237bb.PNG)
Error
![error](https://global.discourse-cdn.com/ionicframework/original/3X/a/1/a1342aa6c872bae5334ab0e39d8d0cf149f1ade8.PNG)
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" %*
)
Its not working. Please Help Thannks
Have you try upgrading node and npm?
No, I have not updated my node & npm. Will do it as last option if nothing works out.
1 Like
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
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.
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;
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
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
1 Like
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.
1 Like
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?
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.
1 Like
Ok I see, so actually you still face the same issue…good luck then!
Thanks. Will try my best to solve this issue. Working in it.