You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 1, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on May 1, 2020. It is now read-only.
Allocation failed - JavaScript heap out of memory #64
Hello @chack would you mind running npm install inside your app and seeing if you still run into this issue? The latest app-scripts includes a fix for this issue.
@adamdbradley Does the flag --max-old-space-size=2048 should help ionic serve to avoid out of memory? If yes, then unfortunately out of memory error is still there, no change with that flag.
@lleevvyy for clarification: you have to paste it into the package.json as is wrote in the comment and not as flag in the terminal. Then you can clearly see the benefit. If you run serve too long it will get the error still sometimes :( but a lot less!
Hello all! I am going to close this issue for now as this specific memory issue has been fixed in v0.0.30. Just for full disclosure, there is another memory issue that is being actively worked on, and that 0.0.31 should go towards fixing. Thanks everyone!
Hey @jgw96, still seeing this, can't really find steps to reproduce it - happens accidentally after some changes in the code while running ionic serve:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
<--- Last few GCs --->
544163 ms: Mark-sweep 1386.9 (1457.0) -> 1392.3 (1457.0) MB, 1335.4 / 0 ms [allocation failure] [GC in old space requested].
545503 ms: Mark-sweep 1392.3 (1457.0) -> 1392.3 (1457.0) MB, 1339.8 / 0 ms [allocation failure] [GC in old space requested].
546834 ms: Mark-sweep 1392.3 (1457.0) -> 1384.5 (1457.0) MB, 1330.6 / 0 ms [last resort gc].
548148 ms: Mark-sweep 1384.5 (1457.0) -> 1386.5 (1457.0) MB, 1313.8 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x126a479e3ac1 <JS Object>
1: findDeclaration [/Users/nixa/Development/Projects/ProjectName/node_modules/rollup/dist/rollup.js:~5359] [pc=0x2fc2c0755ed4] (this=0x3a23996ea6d1 <a Scope with map 0x300771ab0b61>,name=0x126a4795e3f9 <String[1]: i>)
2: bind [/Users/nixa/Development/Projects/ProjectName/node_modules/rollup/dist/rollup.js:6516] [pc=0x2fc2c34eb124] (this=0x3435a6aae4f9 <a Node wit...
my env is:
Your system information:
Cordova CLI: 6.3.1
Gulp version: CLI version 1.2.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.4
Ionic App Lib Version: 2.1.2
Ionic App Scripts Version: 0.0.41
ios-deploy version: 1.9.0
ios-sim version: 5.0.10
OS: Mac OS X El Capitan
Node Version: v5.11.0
Xcode version: Xcode 8.0 Build version 8A218a
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.
Upgrade to Typescript 2.6.1 (or latest) ie npm install typescript@latest
Upgrade Ionic, Ionic Scripts and Ionic CLI TIP: Run 'ionic doctor check' and do the suggested upgrades
Increased my memory for the build by adding this to the package.json to scripts section as a seperate line:
"ionic:build": "node --max-old-space-size=8192 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build"
In terminal Ran 'npm run ionic:build --prod' It is important you us the exact command, if it is correct the terminal will print something like:
node --max-old-space-size=8192 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build
Note if you still have out of memory issues, try increasing the ram further. I currently have it at 12228 as I have a big app. Best of luck!
ok how is this still an issue after 2 years. I am still getting this error. I tried what @bkarv said but then i get "#FailureMessage Object: 0x7febe7443950Illegal instruction (core dumped)"
`cli packages: (/home/bugra/.linuxbrew/lib/node_modules)
can we all agree that the solution to getting a production build with ionic is not to just let some crazy memory leak go all the way to 4-8GB for building a >1MB web application?
Activity
jgw96 commentedon Oct 3, 2016
Hello @chack would you mind running
npm installinside your app and seeing if you still run into this issue? The latest app-scripts includes a fix for this issue.chack commentedon Oct 3, 2016
@jgw96 see ionic-team/ionic-cli#1453 (comment)
adamdbradley commentedon Oct 3, 2016
@chack If you don't add the
--max-old-space-size=2048flag, do you still get the errors with the latest app-scripts?Manduro commentedon Oct 4, 2016
Ran into this using 0.0.28:
cmaart commentedon Oct 4, 2016
Can confirm this as well for 0.0.28
mirkonasato commentedon Oct 4, 2016
To summarise my comments on #85, this patch fixes it for me: https://gist.github.com/mirkonasato/903e039bf341707776c402497afc25bb
shlomiassaf commentedon Oct 4, 2016
Can confirm this as well for 0.0.28
Node: v5.11.1
Error:
Happens around the 5th watch code update.
Aristona commentedon Oct 5, 2016
+1, happens to me too on both 0.0.27 and 0.0.28
Node 6.7.0
MarkChrisLevy commentedon Oct 5, 2016
Confirm, happens to me as well on 0.0.28.
UISTRepo commentedon Oct 5, 2016
+1
MarkChrisLevy commentedon Oct 5, 2016
@adamdbradley Does the flag
--max-old-space-size=2048should helpionic serveto avoid out of memory? If yes, then unfortunately out of memory error is still there, no change with that flag.chack commentedon Oct 5, 2016
@lleevvyy yes it does, see my comment above
MarkChrisLevy commentedon Oct 5, 2016
@chack Ok, thanks.
chack commentedon Oct 5, 2016
@lleevvyy for clarification: you have to paste it into the package.json as is wrote in the comment and not as flag in the terminal. Then you can clearly see the benefit. If you run serve too long it will get the error still sometimes :( but a lot less!
18 remaining items
RyanMcDonald commentedon Oct 7, 2016
Same issue here with broken interfaces. Downgraded to 0.0.28 in the meantime.
jgw96 commentedon Oct 12, 2016
Hello all! I am going to close this issue for now as this specific memory issue has been fixed in v0.0.30. Just for full disclosure, there is another memory issue that is being actively worked on, and that 0.0.31 should go towards fixing. Thanks everyone!
nnixaa commentedon Nov 9, 2016
Hey @jgw96, still seeing this, can't really find steps to reproduce it - happens accidentally after some changes in the code while running
ionic serve:my env is:
shreekantha commentedon Mar 17, 2017
Hey @jgw96 I am also facing the same issue.
Below is the my package.json
{
"name": "dhI",
"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",
"ionic-angular": "2.1.0",
"ionic-native": "2.4.1",
"ionicons": "3.0.0",
"ng2-googlechart": "^2.1.0",
"rxjs": "5.0.0-beta.12",
"sw-toolbox": "3.4.0",
"zone.js": "0.6.26"
},
"devDependencies": {
"@ionic/app-scripts": "1.1.3",
"typescript": "2.0.10"
},
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard",
"cordova-plugin-statusbar"
],
"cordovaPlatforms": [],
"description": "dhI: An Ionic project"
}
timothybclayton commentedon Jul 7, 2017
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!
phonic commentedon Aug 11, 2017
@timothybclayton You've saved my friday. Thanks a lot!
bkarv commentedon Oct 20, 2017
Does anyone know how to increase the node memory in OSX?
manicloudlogic commentedon Nov 21, 2017
Thanks it's working
bigthing33 commentedon Feb 8, 2018
Does anyone know how to increase the node memory in OSX?
bkarv commentedon Feb 8, 2018
@bigthing33 hey mate this worked for me:
Upgrade to Typescript 2.6.1 (or latest) ie npm install typescript@latest
Upgrade Ionic, Ionic Scripts and Ionic CLI TIP: Run 'ionic doctor check' and do the suggested upgrades
Increased my memory for the build by adding this to the package.json to scripts section as a seperate line:
"ionic:build": "node --max-old-space-size=8192 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build"
In terminal Ran 'npm run ionic:build --prod' It is important you us the exact command, if it is correct the terminal will print something like:
node --max-old-space-size=8192 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build
Note if you still have out of memory issues, try increasing the ram further. I currently have it at 12228 as I have a big app. Best of luck!
bicibg commentedon May 17, 2018
ok how is this still an issue after 2 years. I am still getting this error. I tried what @bkarv said but then i get "#FailureMessage Object: 0x7febe7443950Illegal instruction (core dumped)"
`cli packages: (/home/bugra/.linuxbrew/lib/node_modules)
global packages:
local packages:
System:
Environment Variables:
Misc:
`
khaled-elrifaay commentedon Jun 13, 2018
@timothybclayton how to do it in linux
pascalwhoop commentedon Sep 16, 2018
also running into this on linux on node 10.9 ionic cli 4.1.2
when running
ionic build --prod --minifyjs --minifycss --optimizejs --engine browserpascalwhoop commentedon Sep 16, 2018
can we all agree that the solution to getting a production build with ionic is not to just let some crazy memory leak go all the way to 4-8GB for building a >1MB web application?