3.7.0: iOS build with --prod not working

Glad to hear this is being looked at by the ionic team! As a dev with a few large projects, it’s always a little worrisome to be using various workarounds and wondering if updates will break them or affect their use.

Hi @reedrichards, I am building in Windows now and the memory limit is being a problem again. How can I run this command:

node --max-old-space-size=4096 /usr/local/bin/ionic cordova build ios --prod

In Windows. I do not know the location of “ionic” as /usr/local/bin/

Thanks in advance!

@rindegastos I’ve got so much no idea of the Windows environment, I’m really sorry
Hope someone else will be able to help you

I hope this solution helps everyone. To avoid executing the command with the --max-old-space-size=4096 I ended up changing the /bin/ionic or the ionic.cmd (windows) to the following:

#!/bin/node --max_old_space_size=4096

This way the --max-old-space-size=4096 is passed everytime and you can run all the commands normally.

1 Like

I have this configuration and add the --max-old-space-size=8084 on my .zshrc and this just adds time for the same error appear.


   ionic (Ionic CLI)  : 4.2.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0


   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.0.0, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 5 other plugins)


   NodeJS : v10.10.0 (/usr/local/lib/node_modules/node/bin/node)
   npm    : 5.6.0
   OS     : macOS
   Xcode  : Xcode 10.1 Build version 10B61
<--- Last few GCs --->

[996:0x102801c00]   150213 ms: Mark-sweep 8037.4 (8187.9) -> 8037.4 (8189.4) MB, 9282.0 / 0.0 ms  (average mu = 0.076, current mu = 0.002) allocation failure scavenge might not succeed
[996:0x102801c00]   158621 ms: Mark-sweep 8038.4 (8189.4) -> 8038.4 (8190.4) MB, 8399.9 / 0.0 ms  (average mu = 0.038, current mu = 0.001) allocation failure scavenge might not succeed

<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x16677fb5c01d]
    1: StubFrame [pc: 0x16677fb5d3df]
Security context: 0x28e47031e681 <JSObject>
    2: write [0x28e60aa4bdd9] [/Users/guifeliper/My Apps/TalkABit2019/node_modules/typescript/lib/typescript.js:~9597] [pc=0x1667809c9843](this=0x28e60aa4be81 <Object map = 0x28e42ebacf71>,s=0x28e44b5b6049 <String[2]: : >)
    3: write(aka write) [0x28e60aa4c769] [/Users/guifeliper/My Apps/TalkABit2019/node_modules/types...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x100039dbf node::Abort() [/usr/local/bin/node]
 2: 0x100039fc9 node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
 3: 0x1001d1375 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 4: 0x10059c572 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
 5: 0x10059f045 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node]
 6: 0x10059aeef v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
 7: 0x1005990c4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
 8: 0x1005a594c v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 9: 0x1005a59cf v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0x100575354 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
11: 0x1007fcff4 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x16677fb5c01d
13: 0x16677fb5d3df
[ERROR] Non-zero exit from subprocess.

I don’t know more what to do, anyone can help me?

1 Like

Any update…?? for the same reason build failed in Ionic Pro Package build!

I am using 12.18.1 and also increased the size to 16384 but still facing the same issue .

node --max-old-space-size=16384

I am using this command to build my project

sudo node --max-old-space-size=16384 /usr/local/bin/ionic cordova build android --release
sudo node --max-old-space-size=16384 /usr/local/bin/ionic cordova build ios --release

Please help