> ionic cordova build android --prod
> Running app-scripts build: --prod --iscordovaserve --externalIpRequired --nobrowser
> [11:18:38] build prod started ...
> [11:18:38] clean started ...
> [11:18:38] clean finished in 16 ms
> [11:18:38] copy started ...
> [11:18:38] ngc started ...
> [11:19:08] ngc finished in 29.48 s
> [11:19:08] preprocess started ...
> [11:19:08] deeplinks started ...
> [11:19:13] deeplinks finished in 5.05 s
> [11:19:13] optimization started ...
> [11:19:14] copy finished in 35.31 s
> [11:20:06] optimization finished in 52.67 s
> [11:20:06] preprocess finished in 57.72 s
> [11:20:06] webpack started ...
> <--- Last few GCs --->
> 136909 ms: Mark-sweep 1276.6 (1419.2) -> 1276.6 (1435.2) MB, 1325.5 / 0.0 ms [allocation failure] [GC in old space requested].
> 138234 ms: Mark-sweep 1276.6 (1435.2) -> 1276.6 (1435.2) MB, 1324.5 / 0.0 ms [allocation failure] [GC in old space requested].
> 139618 ms: Mark-sweep 1276.6 (1435.2) -> 1284.2 (1419.2) MB, 1383.9 / 0.0 ms [last resort gc].
> 141012 ms: Mark-sweep 1284.2 (1419.2) -> 1291.8 (1419.2) MB, 1393.2 / 0.0 ms [last resort gc].
> <--- JS stacktrace --->
> ==== JS stack trace =========================================
> Security context: 0000027F272CFB49
> 2: /* anonymous */ [D:\ionic2\mytest\node_modules\[email protected]@enhanced-resolve\lib\ConcordModulesPlugin.js:~19] [pc=000003173103F352] (this=0000010F6398FD69 ,request=000001D2A03FD949 ,callback=0000004F5DBF8B81 )
> 3: applyPluginsParallelBailResult1 [D...
> FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
**I have tried add --max-old-space-size**
**#!/usr/bin/env node --max-old-space-size=4096 ,same as up**
**and i alse modify package.json**
**system info is:**
> global packages:
> @ionic/cli-utils : 1.0.0
> Cordova CLI : 6.5.0
> Ionic CLI : 3.0.0
> local packages:
> @ionic/app-scripts : 1.3.7
> @ionic/cli-plugin-cordova : 1.0.0
> @ionic/cli-plugin-ionic-angular : 1.0.0
> Ionic Framework : ionic-angular 3.2.0
> System:
> Node : v6.10.3
> OS : Windows 10
> Xcode : not installed
> ios-deploy : not installed
> ios-sim : not installed
no body has this error anymore?
when i use ionic cordova build android ,everything is ok ,
when i use ionic serve also ok.
but when i user ionic cordova build android --prod, out of memory error …
Thanks for your reply, can you tell me how to add this parameter? or how to make it permanent somehow?
now i only user the follow build command:
ionic cordova build android --prod
how can i add
> --max_old_space_size=4096
parameter?
i’m so sorry to you!!!
b) make the process use less memory.
How to do it
OK,I try like this
ionic cordova build android --prod --max_old_space_size=4096
the errors as:
[16:33:57] build prod started …
[16:33:59] clean started …
[16:33:59] clean finished in 4 ms
[16:33:59] copy started …
[16:33:59] ngc started …
[16:34:49] ngc finished in 49.91 s
[16:34:49] preprocess started …
[16:34:49] deeplinks started …
[16:34:56] deeplinks finished in 6.40 s
[16:34:56] optimization started …
[16:34:57] copy finished in 57.88 s
[16:36:12] optimization finished in 76.21 s
[16:36:12] preprocess finished in 82.62 s
[16:36:12] webpack started …
<— Last few GCs —>
209703 ms: Mark-sweep 1254.8 (1438.4) -> 1254.8 (1438.4) MB, 1870.7 / 0.0 ms [allocation failure] [GC in old space requested].
211573 ms: Mark-sweep 1254.8 (1438.4) -> 1254.8 (1438.4) MB, 1869.2 / 0.0 ms [allocation failure] [GC in old space requested].
213658 ms: Mark-sweep 1254.8 (1438.4) -> 1261.5 (1422.4) MB, 2084.9 / 0.0 ms [last resort gc].
215697 ms: Mark-sweep 1261.5 (1422.4) -> 1268.4 (1422.4) MB, 2038.9 / 0.0 ms [last resort gc].
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
if [ -x "$basedir/node" ]; then
"$basedir/node --max_old_space_size=4096" "$basedir/../_@[email protected]@@ionic/app-scripts/bin/ionic-app-scripts.js" "$@"
ret=$?
node --max_old_space_size=4096 "$basedir/../_@[email protected]@@ionic/app-scripts/bin/ionic-app-scripts.js" "$@"
ret=$?
exit $ret
Undo your code and Try this once:
File: project\node_modules\@ionic\app-scripts\bin\ionic-app-scripts.js
Add code just below the #!/usr/bin/env node:
#!/usr/bin/env node --max_old_space_size=4096
can you give me a screenshot of ionic-app-scripts.js code?
i modify like follow ,but when memory use 14XX mb,it out of memory,it’s does not work for me…