Reputation: 73
I also tried $env:NODE_OPTIONS="--max-old-space-size=8000" and set my max memory 8000 still it gives the same error whenever I npm run build
so I am not able to deploy
I have 8GB RAM I don't know what else I can do
PS C:\Users\91955\Desktop\SFmovies\frontend> npm run build
> [email protected] build
> react-scripts build
Creating an optimized production build...
<--- Last few GCs --->
[17892:000001D77EA8E2A0] 36182 ms: Scavenge 2034.0 (2082.8) -> 2032.4 (2083.0) MB, 3.1 / 0.0 ms (average mu = 0.183, current mu = 0.156) allocation failure
[17892:000001D77EA8E2A0] 36186 ms: Scavenge 2034.5 (2083.0) -> 2032.8 (2083.3) MB, 2.5 / 0.0 ms (average mu = 0.183, current mu = 0.156) allocation failure
[17892:000001D77EA8E2A0] 36190 ms: Scavenge 2035.0 (2083.5) -> 2033.3 (2087.8) MB, 2.5 / 0.0 ms (average mu = 0.183, current mu = 0.156) allocation failure
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF6526730AF v8::internal::CodeObjectRegistry::~CodeObjectRegistry+112511
2: 00007FF652602216 DSA_meth_get_flags+65542
3: 00007FF6526030CD node::OnFatalError+301
4: 00007FF652F34B6E v8::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF652F1F09D v8::SharedArrayBuffer::Externalize+781
6: 00007FF652DC268C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
7: 00007FF652DCF339 v8::internal::Heap::PublishPendingAllocations+1129
8: 00007FF652DCC30A v8::internal::Heap::PageFlagsAreConsistent+2842
9: 00007FF652DBEF89 v8::internal::Heap::CollectGarbage+2137
10: 00007FF652DBD140 v8::internal::Heap::AllocateExternalBackingStore+2000
11: 00007FF652DE1A76 v8::internal::Factory::NewFillerObject+214
12: 00007FF652B14CB5 v8::internal::DateCache::Weekday+1797
13: 00007FF652FC2541 v8::internal::SetupIsolateDelegate::SetupHeap+494417
14: 000001D701EE9A38
Upvotes: 3
Views: 5597
Reputation: 73
Solved my issue by
adding this under "scripts"
in my package.json
"build": "react-scripts --max_old_space_size=4096 build"
my Package.json if you have any doubt ..
Upvotes: 4