I've been getting this for several weeks on first compile of the day. It usually compiles after closing WebStorm and recompiling. No luck today. I increased my JavaScript memory to 8 GB, at least as far as I can tell? I'm not sure if this is only issue though. Please advise as I'm unable to run my project at all at this point. I have 48 GB of RAM on my machine, so I know that can't be the issue. It always crasches at 93% as shown below.
Here are my heap stats: I'm currently using Node.js v12.18.3
v8.getHeapStatistics() { total_heap_size: 5222400, total_heap_size_executable: 573440, total_physical_size: 5222400, total_available_size: 8637309544, used_heap_size: 3011792, heap_size_limit: 8640266240, malloced_memory: 65600, peak_malloced_memory: 1053672, does_zap_garbage: 0, number_of_native_contexts: 1, number_of_detached_contexts: 0 }
Not sure exactly how to proceed.
93% after chunk asset optimization SourceMapDevToolPlugin vendor.js generate SourceMap <--- Last few GCs --->
[19860:000001C5262FB520] 95014 ms: Mark-sweep 2038.8 (2053.9) -> 2037.0 (2053.9) MB, 457.5 / 0.0 ms (average mu = 0.105, current mu = 0.016) allocation failure scavenge might not succeed [19860:000001C5262FB520] 95668 ms: Mark-sweep 2038.9 (2053.9) -> 2036.9 (2057.9) MB, 645.4 / 0.1 ms (average mu = 0.063, current mu = 0.013) allocation failure scavenge might not succeed
<br> <--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 00007FF66CEFB3BD] Security context: 0x0356158808d1 <JSObject> 1: keys [00000356158815B1](this=0x035615880969 <JSFunction Object (sfi = 000003917984A381)>,0x0001c3b07991 <Object map = 000002552A180439>) 2: SourceNode_walkSourceContents [000002E73AEEB461] [D:\App Development\Resolution\ASPNET-Zero\Resolution\angular\node_modules\source-map\lib\source-node.js:~301] [pc=00000003F63BDD42](this=0x02f6219928b9 <Sour...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF66C2E5EBF napi_wrap+114095 2: 00007FF66C290B46 v8::base::CPU::has_sse+66998 3: 00007FF66C291946 v8::base::CPU::has_sse+70582 4: 00007FF66CAA6E4E v8::Isolate::ReportExternalAllocationLimitReached+94 5: 00007FF66CA8EF21 v8::SharedArrayBuffer::Externalize+833 6: 00007FF66C95B18C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436 7: 00007FF66C9663C0 v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312 8: 00007FF66C962EE4 v8::internal::Heap::PageFlagsAreConsistent+3204 9: 00007FF66C9586E3 v8::internal::Heap::CollectGarbage+1283 10: 00007FF66C956D54 v8::internal::Heap::AddRetainedMap+2452 11: 00007FF66C97809D v8::internal::Factory::NewFillerObject+61 12: 00007FF66C6DE1E1 v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+1665 13: 00007FF66CEFB3BD v8::internal::SetupIsolateDelegate::SetupHeap+546637 14: 00007FF66CECA747 v8::internal::SetupIsolateDelegate::SetupHeap+346839 15: 00000003F63BDD42 npm ERR! code ELIFECYCLE npm ERR! errno 134 npm ERR! [email protected] start: `gulp buildDev && ng serve --host 0.0.0.0 --port 4200` npm ERR! Exit status 134 npm ERR! npm ERR! Failed at the [email protected] start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\...AppData\Roaming\npm-cache\_logs\2021-09-13T20_04_01_432Z-debug.log
9 Answer(s)
-
0
Hi @KarakTheWise
Is it possible for you to share your angular project via email with [email protected] ?
Thanks,
-
0
Thank you! It has been sent.
-
0
Hi,
Just replied to your email. We can continue via email for this case.
Thanks,
-
0
Excellent! Thank you. I'll take a look at it now.
-
0
The problem is solved via email support.
-
0
Hey,
I'm having the same issue after updating from 8.1 to 10.4.
Was there another solution than just changing the node Memory allocation?
-
0
Well, what solved it for me was adding this line to my scripts in package.json:
"build-serve": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve",
To run the project I use
npm run build-serve
I also was advised to by ASP-Zero support to remove 'gulp buildDev' from the start script:
"<span class="colour" style="color: rgb(34, 34, 34);">Then, just run "</span>npm run create-dynamic-bundles<span class="colour" style="color: rgb(34, 34, 34);">" once... You only need to run "</span>npm run create-dynamic-bundles<span class="colour" style="color: rgb(34, 34, 34);">" if you make any changes in the files which is used in bundles.json."</span>
<span class="colour" style="color: rgb(34, 34, 34);">That alone did not solve problem since the root of the problem was this error:</span>
<span class="colour" style="color: rgb(34, 34, 34);">FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory</span>
Thus the need add the 'build-serve' section to the scripts.
<span class="colour" style="color: rgb(34, 34, 34);">Here's my current scripts section from package.json:</span>
"scripts": { "ng": "ng", "publish": "gulp build && ng build --prod", "start": "ng serve --host 0.0.0.0 --port 4200", "hmr": "gulp buildDev && ng serve --host 0.0.0.0 --port 4200 --hmr", "test": "gulp buildDev && ng test", "pree2e": "webdriver-manager update --standalone false --gecko false", "e2e": "gulp buildDev && protractor", "create-dynamic-bundles": "gulp buildDev", "build-serve": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve", "nswag": "cd nswag/ && refresh.bat" },
I hope that helps your issue!
-
0
Thank you very much for the detailed answer! Solved the issue for me too!
-
0
Excellent! So glad it helpled.