Note: for support questions, please use one of these channels:
https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/
execute ionic run android --prod or ionic build android --prod --release with no error.
Steps to reproduce:

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
ionic info:
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.3
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 8.1
Node Version: v6.9.2
Xcode version: Not installed
package.json:
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"description": "DemoIonic: An Ionic project",
"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"
},
"config": {
"ionic_experimental_manual_treeshaking": true,
"ionic_experimental_purge_decorators": true,
"ionic_uglifyjs": "./config/uglifyjs.config.js"
},
"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",
"ionic-angular": "2.0.0",
"ionic-native": "2.5.1",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26",
"sw-toolbox": "3.4.0",
"@angular/router": "^2.0.0-rc.2",
"crypto-js": "^3.1.7",
"es6-shim": "^0.35.0",
"intl": "^1.2.4",
"ng2-translate": "5.0.0",
"reflect-metadata": "^0.1.3",
"ts-md5": "^1.2.0"
},
"devDependencies": {
"@ionic/app-scripts": "1.1.2",
"@types/lodash": "4.14.45",
"typescript": "2.0.9"
},
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-whitelist",
"ionic-plugin-keyboard",
"cordova-sqlite-storage",
{
"id": "phonegap-plugin-push",
"locator": "https://github.com/phonegap/phonegap-plugin-push",
"variables": {
"SENDER_ID": "353844722544"
}
},
"cordova-plugin-compat",
"cordova-plugin-camera",
"cordova-plugin-crosswalk-webview",
{
"id": "cordova-plugin-googlemaps",
"locator": "https://github.com/phonegap-googlemaps-plugin/cordova-plugin-googlemaps",
"variables": {
"API_KEY_FOR_ANDROID": "AIzaSyB3_8DxYg3NahSxxB2iHje1MXfBlsg7a9I",
"API_KEY_FOR_IOS": "AIzaSyAS6q_-xiNQmSKB6Mn-Kft6ZZpppVQIvc8"
}
},
"cordova-plugin-geolocation",
"cordova-plugin-x-socialsharing",
"cordova-plugin-network-information",
{
"id": "cordova-plugin-splashscreen",
"locator": "https://github.com/apache/cordova-plugin-splashscreen"
},
{
"id": "cordova-plugin-sslcertificatechecker",
"locator": "https://github.com/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin"
}
],
"cordovaPlatforms": [
"ios",
"android"
]
}
Wow, that is a huge app! The solution in your PR seems valid. Does it fix the problem for you?
Thanks,
Dan
@danbucholtz It dont. I added --max_old_space_size=2048 or 8000 in
node_modules\@ionic\app-scripts\bin\ionic-app-scripts.js
but the error still show up. I do not know I added the correct file anymore.
Code insert:
#!/usr/bin/env node --max_old_space_size=2048
Try it from your package.json scripts section:
"ionic:serve" : "node --max_old_space_size=2048 ./node_modules/.bin/ionic-app-scripts serve"
Same with build. I think that will work for you. Please play around with that and let me know how it goes.
Thanks,
Dan
@danbucholtz I add this in package.json scripts section:
"ionic:build": "node --max_old_space_size=2048 ./node_modules/.bin/ionic-app-scripts build"
This show me a error.
Please help me, thanks!!!
@danbucholtz Having the same error when trying to build with --prod flag.
Tried changing max_old_space_size to 2048, even to 4096 did not help. Also, reading through other similar reports, tried to reduce amount of sass color variables, but that did not help either, even with only 3 colors defined, same error appeared. As the error is not very informative, could not trace the part that's causing this.
Tried using all versions of app-scripts from 1.0.0 up to the latest with no luck. As in some other cases, rolling back to app-scripts <= 0.0.46 builds just fine.
My app has over 60 pages, ~20 reusable components and some other stuff like services, pipes, directives, etc., so i guess it could be closely related to the reported issue.
@themastersoda
You can try ionic-angualor 2.0.1 + ionic--app-script 1.0.0 + update last version of ng2-tranlartor ( It worked for me) or try add --max_old_space_size=2048 in folder "node_modules/.bin/ionic-app-scripts.cmd"
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe --max_old_space_size=2048 " "%~dp0..\@ionic\app-scripts\bin\ionic-app-scripts.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node --max_old_space_size=2048 "%~dp0..\@ionic\app-scripts\bin\ionic-app-scripts.js" %*
)
@badboy91vn i don't use ng2-translator, and I tried all the other things you mentioned, but thanks for help :)
I've was able to workaround this issue on Ionic v3.5, Ionic cli 3.4.0, and Node.js 6.9.1. We have a big app with lots of modules and heap space errors occurring every build, whether "ionic serve", or "ionic cordova run --prod".
Modify your ionic.cmd file in C:\Users\
@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" %*
)
Good luck!
Most helpful comment
@themastersoda
You can try ionic-angualor 2.0.1 + ionic--app-script 1.0.0 + update last version of ng2-tranlartor ( It worked for me) or try add --max_old_space_size=2048 in folder "node_modules/.bin/ionic-app-scripts.cmd"