Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Build Failed if flag --prod is included #783

Closed
sfaizanh opened this issue Feb 27, 2017 · 2 comments
Closed

Build Failed if flag --prod is included #783

sfaizanh opened this issue Feb 27, 2017 · 2 comments

Comments

@sfaizanh
Copy link

ionic build ios --prod --release

> linkagoal@ ionic:build /Users/faizanhasan/Documents/Projects/app/
> ionic-app-scripts build "--prod" "--release"

ionic-app-scripts 1.1.4 
build prod started ... 
clean started ... 
clean finished in 2 ms 
copy started ... 
ngc started ... 
ngc finished in 24.89 s 
preprocess started ... 
optimization started ... 
copy finished in 25.47 s 
optimization finished in 24.01 s 
preprocess finished in 24.01 s 
rollup started ... 
rollup: 
commonjs-proxy:/Users/faizanhasan/Documents/Projects/app/node_modules/@angular/core/index.js
has issued a warning: 'default' is not exported by 'node_modules/@angular/core/index.js' 

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::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
 4: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
 5: 
<--- Last few GCs --->

  101723 ms: Mark-sweep 1278.5 (1434.4) -> 1278.5 (1434.4) MB, 1382.2 / 0.0 ms [allocation failure] [GC in old space requested].
  103036 ms: Mark-sweep 1278.5 (1434.4) -> 1278.5 (1434.4) MB, 1313.1 / 0.0 ms [allocation failure] [GC in old space requested].
  104633 ms: Mark-sweep 1278.5 (1434.4) -> 1290.4 (1418.4) MB, 1595.7 / 0.0 ms [last resort gc].
  105860 ms: Mark-sweep 1290.4 (1418.4) -> 1302.4 (1418.4) MB, 1226.4 / 0.0 ms [last resort gc].

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x1ec53aacfb51 <JS Object>
    1: decode(aka decode) [/Users/faizanhasan/Documents/Projects/app/node_modules/rollup/dist/rollup.js:~279] [pc=0x8a2f2e871af] (this=0x1ec53aa04381 <undefined>,mappings=0x3ca6f0504201 <Very long string[7061959]>)
    2: render [/Users/faizanhasan/Documents/Projects/app/node_modules/rollup/dist/rollup.js:9705] [pc=0x8a2f2e61541] (this=0x36667cd58109 ...

v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
 6: 0x8a2f29079a7

System Information

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.4
ios-deploy version: 1.9.1 
ios-sim version: 5.0.6 
OS: macOS Sierra
Node Version: v6.9.4
Xcode version: Xcode 8.2.1 Build version 8C1002

Which @ionic/app-scripts version are you using?
@ionic/app-scripts 1.1.4

"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",
    "@types/lodash": "^4.14.50",
    "angular2-elastic": "^0.13.0",
    "angular2-moment": "^1.2.0",
    "ionic-angular": "^2.0.1",
    "ionic-audio": "git://github.com/sfaizanh/ionic-audio.git#2.0",
    "ionic-img-viewer": "^1.2.1",
    "ionic-native": "2.4.1",
    "ionicons": "3.0.0",
    "lodash": "^4.17.4",
    "ng2-sticky-kit": "^2.0.3",
    "ng2-translate": "^5.0.0",
    "rollup-plugin-replace": "^1.1.1",
    "rxjs": "5.0.0-beta.12",
    "socket.io": "^1.7.2",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^1.1.4",
    "typescript": "2.0.9"
  },
@sfaizanh
Copy link
Author

Fixed with #768. See changes

@timothybclayton
Copy link

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<user>\AppData\Roaming\npm by adding --max_old_space_size. I set mine to 8096.

@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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants