ionic-frameworkionic-appflow

Build script fails to build app in ionic deploy [ionic]


I am trying to build and distribute my app using ionic deploy in the Ionic Dashboard. Due to the nature of my app, I am using a custom build script:

"scripts": {
    "build": "npm install -g ionic && npm install -g cordova && npx gulp svgSprite && npm install angular-idle-preload --save && node --max_old_space_size=8192 node_modules/.bin/ng build --prod --verbose"
}

Everything builds fine until around 90% mark, where I get the following error:

89% record hash 0ms record hash
90% module assets processing84ms module assets processing
90% chunk assets processingKilled
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! app@0.0.0 build: `npm install -g ionic && 
npm install -g cordova && npx gulp svgSprite && npm install angular-idle-preload --save && node --max_old_space_size=8192 node_modules/.bin/ng build --prod --verbose`
npm ERR! Exit status 137
npm ERR! 
npm ERR! Failed at the app@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-03-21T18_17_39_693Z-debug.log

What's weird is that when I remove the --prod flag it builds just fine. Why am I getting this error? is it a memory issue?


Solution

  • npm install -g ionic && npm install -g cordova && npx gulp svgSprite && npm install angular-idle-preload --save && export NODE_OPTIONS=--max_old_space_size=8096 && ionic build --optimizejs --cleancss --cleanjs