Closed bkarv closed 5 years ago
Thanks for your issue! Please create and share a repo where we can test it!
Thanks but it’s not possible unfortunately it’s a large multi component app and commercially sensitive. What I need to know is how I can increase the build memory similar to ionic 3 which will help me a great deal to furthe debug. Also I’ve tried adding —verbose for debugging as well but nothing prints
Just look how it's working for Angular because Ionic just use the Angular CLI
As you can see the building process is ng run app:build:production
.
I close this issue because it's not related to Ionic, more to Angular. And you cannot show us a repo, so we cannot check it if it's related to Ionic (but I don't think so)
No worries and thanks for the tip. I search the issue in angular 7 cli. Although not Ionic related it would be something many users will have once Ionic 4 project gets big, so here is the solution for OS.
In terminal console:
export NODE_OPTIONS=--max_old_space_size=8096
If using windows:
set NODE_OPTIONS=--max_old_space_size=8096
Prior to running ionic build --prod
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Bug Report
Ionic version: [x] 4.x
Current behavior: When running ionic build --prod , I am getting an error:
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
My last successful build was with 4.0.0-beta.16.
I had the same issue with Ionic 3 and fixed it by increasing my memory using the advice given in this github link:
Ionic App Script
The issue the solution for Ionic 3 doesn't work for Ionic 4. That is adding the following to app scripts:
add this to the package.json scripts
"ionic:build": "node --max-old-space-size=8192 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build"
How do you increase your memory in Ionic 4 for building? Has anyone had this issue in Ionic 4?
Note: I have no issues running Ionic Serve. This only occurs with the build.
Expected behavior: Build successfully
Steps to reproduce: Create a big app and run ionic ionic build --prod Related code:
The Complete error:
` ionic build --prod
<--- Last few GCs --->
[83533:0x102801c00] 121660 ms: Mark-sweep 1329.4 (1443.1) -> 1326.4 (1447.6) MB, 671.1 / 0.0 ms (average mu = 0.199, current mu = 0.124) allocation failure scavenge might not succeed [83533:0x102801c00] 122419 ms: Mark-sweep 1332.4 (1447.6) -> 1328.6 (1456.1) MB, 731.3 / 0.0 ms (average mu = 0.122, current mu = 0.037) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x18fcb001e6e1
1: getOptions(aka getOptions) [0x18fc4dbfd579] [/Users/karvanj/www/ourmgmt-client/node_modules/acorn/dist/acorn.js:~402] [pc=0x30d70ed115fc](this=0x18fc4e4826f1 ,opts=0x18fc90688de1
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x10003ae75 node::Abort() [/usr/local/bin/node] 2: 0x10003b07f node::OnFatalError(char const, char const) [/usr/local/bin/node] 3: 0x1001a7ae5 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, bool) [/usr/local/bin/node] 4: 0x100572ef2 v8::internal::Heap::FatalProcessOutOfMemory(char const) [/usr/local/bin/node] 5: 0x1005759c5 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/usr/local/bin/node] 6: 0x10057186f v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node] 7: 0x10056fa44 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node] 8: 0x10057c2dc v8::internal::Heap::AllocateRawWithLigthRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node] 9: 0x10057c35f v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node] 10: 0x1005617d2 v8::internal::Handle v8::internal::Factory::NewWeakFixedArrayWithMap(v8::internal::Heap::RootListIndex, int, v8::internal::PretenureFlag) [/usr/local/bin/node]
11: 0x100553ada v8::internal::Factory::NewTransitionArray(int, int) [/usr/local/bin/node]
12: 0x10086a17d v8::internal::TransitionsAccessor::Insert(v8::internal::Handle, v8::internal::Handle, v8::internal::SimpleTransitionFlag) [/usr/local/bin/node]
13: 0x100698328 v8::internal::Map::ConnectTransition(v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::SimpleTransitionFlag) [/usr/local/bin/node]
14: 0x100687281 v8::internal::Map::CopyReplaceDescriptors(v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::TransitionFlag, v8::internal::MaybeHandle, char const , v8::internal::SimpleTransitionFlag) [/usr/local/bin/node]
15: 0x10068397f v8::internal::Map::CopyAddDescriptor(v8::internal::Handle, v8::internal::Descriptor, v8::internal::TransitionFlag) [/usr/local/bin/node]
16: 0x1006836e2 v8::internal::Map::CopyWithField(v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::PropertyAttributes, v8::internal::PropertyConstness, v8::internal::Representation, v8::internal::TransitionFlag) [/usr/local/bin/node]
17: 0x100699f32 v8::internal::Map::TransitionToDataProperty(v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::PropertyAttributes, v8::internal::PropertyConstness, v8::internal::Object::StoreFromKeyed) [/usr/local/bin/node]
18: 0x100664b38 v8::internal::LookupIterator::PrepareTransitionToDataProperty(v8::internal::Handle, v8::internal::Handle, v8::internal::PropertyAttributes, v8::internal::Object::StoreFromKeyed) [/usr/local/bin/node]
19: 0x10068a394 v8::internal::Object::AddDataProperty(v8::internal::LookupIterator , v8::internal::Handle, v8::internal::PropertyAttributes, v8::internal::ShouldThrow, v8::internal::Object::StoreFromKeyed) [/usr/local/bin/node]
20: 0x1007f1459 v8::internal::Runtime::SetObjectProperty(v8::internal::Isolate*, v8::internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::LanguageMode) [/usr/local/bin/node]
21: 0x1007f4ca3 v8::internal::Runtime_SetProperty(int, v8::internal::Object*, v8::internal::Isolate) [/usr/local/bin/node]
22: 0x30d70c45be3d
23: 0x30d70ed115fc
24: 0x30d70c4118d5
[ERROR] Signal exit from subprocess.
`
My package.json
Ionic info: