0

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

enter image description here

enter image description here

Thanks

1 Answers1

0

Try this

First of all try npm install And follow the below steps

  1. add this to the package.json scripts
"ionic:build": "node --max-old-space-size=8192 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build",


  2. run the command:
npm run ionic:build --prod


  3. run the commands:
cordova build android --release

  4. cordova build ios --release