FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

ionic-hello-world@ ionic:serve C:\stud
ionic-app-scripts serve “–v2” “–address” “0.0.0.0” “–port” “8100” “–livere
load-port” “35729”

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memo
ry

npm ERR! Windows_NT 6.1.7601
npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\
node_modules\npm\bin\npm-cli.js” “run” “ionic:serve” “–” “–v2” “–address”
“0.0.0.0” “–port” “8100” “–livereload-port” “35729”
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@ ionic:serve: ionic-app-scripts serve "--v2" "--addr ess" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the ionic-hello-world@ ionic:serve script ‘ionic-app-scripts
serve “–v2” “–address” “0.0.0.0” “–port” “8100” “–livereload-port” “35729”’.

npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world pac
kage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts serve “–v2” “–address” “0.0.0.0” “–port” "8100
" “–livereload-port” “35729”
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-hello-world
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\stud\npm-debug.log
There was an error serving your Ionic application: There was an error with the s
pawned command: serve

Have you found any solution to this?
This happens to me whenever I build with --prod flag.

i have the same issue with flag --prod

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

ionic-app-scripts version, please.

image

I consider posting screenshots of text incredibly rude, but your problem is fixed in app-scripts 1.2.0, so you should upgrade it.

Sorry for this misunderstanding :frowning:

How to update only ionic app script.

i try with npm update @ionic/app-scripts but doesn’t work

Editing package.json and running npm i should work.

after update app script to 1.2.0 version i build ios app with prod flag.

after build i open xcodeproject file with xcode and when i run on my iphone the app show blank (white) screen. if I don’t compile with --prod flag the app work normally.

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic/storage": "1.1.7",
    "@ngx-translate/core": "^6.0.1",
    "@ngx-translate/http-loader": "0.0.3",
    "angularfire2": "^2.0.0-beta.8",
    "date-fns": "^1.28.2",
    "intl": "^1.2.5",
    "ion2-calendar": "^1.0.1",
    "ionic-angular": "2.0.1",
    "ionic-native": "2.4.1",
    "ionic2-calendar": "^0.2.3",
    "ionicons": "3.0.0",
    "moment": "^2.17.1",
    "ng2-translate": "^5.0.0",
    "rxjs": "5.0.0-beta.12",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.2.0",
    "typescript": "2.0.9"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "ionic-plugin-keyboard",
    "cordova-plugin-splashscreen"
  ],
  "cordovaPlatforms": [],
  "description": "CostaEventiUpdate: An Ionic project"
}

Any solution for me?

Your package.json still shows you has using app scripts version 1.2.0.

Change the line
"@ionic/app-scripts": "1.2.0",

to:
"@ionic/app-scripts": "1.3.6",

Then run npm i.

after update to “@ionic/app-scripts”: "1.3.6"
I have this error

[00:09:10]  ionic-app-script task: "build" 
[00:09:10]  TypeError: Cannot read property 'codeGen' of undefined 
TypeError: Cannot read property 'codeGen' of undefined
    at Object.doCodegen (/Users/filippodicostanzo/Desktop/CostaEventiFinal/node_modules/@ionic/app-scripts/dist/aot/codegen.js:6:50)
    at /Users/filippodicostanzo/Desktop/CostaEventiFinal/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:42:30

It’s fixed by just removing node_modules folder and run npm install again in your project.

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

just make sure your ionic.cmd file has above space allocation, it worked.

i cant found ionic.cmd in my project…can you tell me path or location where i found & give me other solution for the same error…i have many try to solve this issue but i cant found any solutions so kindly suggest for solving this issue.

Error when i run IOS in macbook with latest IONIC version 3.9 with latest CLI

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/usr/local/bin/node]
2: node::FatalException(v8::Isolate*, v8::Localv8::Value, v8::Localv8::Message) [/usr/local/bin/node]
3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
4: v8::internal::factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/usr/local/bin/node]
5: v8::internal::Runtime_StringBuilderJoin(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
6: 0x2934526092a7
7: 0x293452beb559

i am find solution for my problem try it u also

node --max-old-space-size=4096 /usr/local/bin/ionic cordova build ios --prod

1 Like

How many pages are in your project? I’m having the same issue.

where file ionic.cmd in mac