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

JavaScript heap out of memory #808

Closed
rehiy opened this issue Mar 10, 2017 · 5 comments
Closed

JavaScript heap out of memory #808

rehiy opened this issue Mar 10, 2017 · 5 comments

Comments

@rehiy
Copy link

rehiy commented Mar 10, 2017

[11:18:12] ionic-app-scripts 1.1.4
[11:18:12] build prod started ...
[11:18:12] clean started ...
[11:18:12] clean finished in 1 ms
[11:18:12] copy started ...
[11:18:12] ngc started ...
[11:19:30] ngc finished in 77.54 s
[11:19:30] preprocess started ...
[11:19:30] optimization started ...
[11:19:30] copy finished in 78.36 s
[11:19:58] optimization finished in 28.39 s
[11:19:58] preprocess finished in 28.39 s
[11:19:58] webpack started ...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Your system information:

ordova CLI: 6.5.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.0
Xcode version: Not installed

@themastersoda
Copy link

Try changing @ionic/app-scripts package in node_modules like in this PR: #768
It seems to have worked for some of the users.
However, it didn't work for me exactly like as shown there, so i had to add the --max-_old_space_size=2048 flag to my ./node_modules/.bin/ionic-app-scripts.cmd (or the one without extension, depending on your OS).
I have no idea why this is not included in the package itself yet, but in the meantime you can apply this fix yourself.

@kleeb
Copy link

kleeb commented Mar 10, 2017

Have the same problem after upgrading to 2.2.0, but only on the release build.
I do confirm that adding --max_old_space_size=2048 to the script solves the javascript heap size, however after that I am getting:

[10:20:35]  rollup finished in 36.66 s 
[10:20:35]  sass started ... 
[10:20:35]  transpile bundle started ... 
[10:20:55]  build prod failed: Maximum call stack size exceeded 
[10:20:55]  ionic-app-script task: "build" 
[10:20:55]  RangeError: Maximum call stack size exceeded 
RangeError: Maximum call stack size exceeded
    at isMatchingReference (/Users/kleeb/workspace/ionic/node_modules/typescript/lib/typescript.js:33297:37)
    at getTypeAtFlowArrayMutation (/Users/kleeb/workspace/ionic/node_modules/typescript/lib/typescript.js:33913:21)
    at getTypeAtFlowNode (/Users/kleeb/workspace/ionic/node_modules/typescript/lib/typescript.js:33847:32)
    at getTypeAtFlowArrayMutation (/Users/kleeb/workspace/ionic/node_modules/typescript/lib/typescript.js:33914:36)

@kleeb
Copy link

kleeb commented Mar 10, 2017

Forget it. I was using Typescript 2.2.1, switching back to recommended 2.0.9 works like charm.

@themastersoda
Copy link

themastersoda commented Mar 10, 2017

Strange, maybe you are using different typescript version than suggested?
After adding --max_old_space_size=2048 building with --prod flag succeeds for me, however application is stuck with white screen on startup and inspecting shows error Uncaught TypeError: Cannot read property '_' of undefined. However, dev build works without any problems.

EDIT: quick thinking, you fixed it before i was able to post it! 🥇

@danbucholtz
Copy link
Contributor

Fixed in 1.2.0.

Thanks,
Dan

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

4 participants