Kumar
Kumar

Reputation: 29

Windows10 - FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Getting JavaScript heap out of memory while doing any npm command. Also i am not seeing .npmrc file in my users folder

Node Version Latest : v10.15.1 , npm : 6.4.1

I tried reinstalling nodejs and npm I tried increase size by using command node --max-old-space-size=8192

and other commands provided in the forums but nothing helped. Pasted the logs above.

[ .................] \ fetchMetadata: sill install loadAllDepsIntoIdealTree
<--- Last few GCs --->

[25040:0000019200D9B400]   314378 ms: Scavenge 7987.0 (8133.8) -> 7985.4 (8134.8) MB, 15.4 / 0.0 ms  (average mu = 0.068, current mu = 0.028) allocation failure
[25040:0000019200D9B400]   314438 ms: Scavenge 7987.7 (8134.8) -> 7986.5 (8137.8) MB, 15.1 / 0.0 ms  (average mu = 0.068, current mu = 0.028) allocation failure
[25040:0000019200D9B400]   314524 ms: Scavenge 7989.2 (8137.8) -> 7987.8 (8148.3) MB, 16.8 / 0.0 ms  (average mu = 0.068, current mu = 0.028) allocation failure

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF60BC20EFA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4810
 2: 00007FF60BBFA296 node::MakeCallback+4518
 3: 00007FF60BBFAC80 node_module_register+2160
 4: 00007FF60BE909BE v8::internal::FatalProcessOutOfMemory+846
 5: 00007FF60BE908EF v8::internal::FatalProcessOutOfMemory+639
 6: 00007FF60C3CE954 v8::internal::Heap::MaxHeapGrowingFactor+11476
 7: 00007FF60C3C50B7 v8::internal::ScavengeJob::operator=+25543
 8: 00007FF60C3C362C v8::internal::ScavengeJob::operator=+18748
 9: 00007FF60C3C97A7 v8::internal::Heap::CreateFillerObjectAt+983
10: 00007FF60C24E87C v8::internal::interpreter::Interpreter::GetDispatchCountersObject+81388
11: 00007FF60BB79ACE v8::internal::StackGuard::ArchiveSpacePerThread+59982
12: 00007FF60BB7A0E3 v8::internal::StackGuard::ArchiveSpacePerThread+61539
13: 00007FF60BC643F4 uv_dlerror+2436
14: 00007FF60BC65003 uv_run+179
15: 00007FF60BC0185E node::NewContext+1966
16: 00007FF60BC02145 node::NewIsolate+725
17: 00007FF60BC02A34 node::Start+2004
18: 00007FF60BAA9719 node::MultiIsolatePlatform::MultiIsolatePlatform+601
19: 00007FF60C69DF28 v8::internal::compiler::OperationTyper::ToBoolean+142280
20: 00007FFE468A3034 BaseThreadInitThunk+20
21: 00007FFE48B53691 RtlUserThreadStart+33

Upvotes: 1

Views: 5514

Answers (2)

Onen simon
Onen simon

Reputation: 768

The solution which I used was to upgrade the node js version from v10.15.1 to v12.16.1 or the latest version of Node Js.


The command 'node —-max old space size=8192 node modules/@angular / cli / bin / ng build —prod ' works but has limitations, e.g. you should have ample memory on your machine to run the production build.

Upvotes: 0

devson
devson

Reputation: 1000

For me below command worked

node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod

Upvotes: 2

Related Questions