`gatsby build` fails with FATAL ERROR exit code 134: JavaScript heap out of memory
See original GitHub issueHey there, thanks for this starter! It looks interesting and I appreciate how you make everything editable through netlify cms.
I wanted to give it a try, but sadly the develop build fails.
Running gatsby build
fails with exit code 134 and this output:
[...] // all good up to this point
success run static queries - 0.012 s — 1/1 106.03 queries/second
⠋ Building production JavaScript and CSS bundles
<--- Last few GCs --->
[10220:0x3773400] 31655 ms: Mark-sweep 1314.9 (1451.5) -> 1311.9 (1453.5) MB, 1782.6 / 0.0 ms (average mu = 0.080, current mu = 0.008) allocation failure scavenge might not succeed
[10220:0x3773400] 33380 ms: Mark-sweep 1320.2 (1453.5) -> 1319.7 (1455.0) MB, 1711.5 / 0.0 ms (average mu = 0.044, current mu = 0.008) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x39df90bdbe1d]
Security context: 0x1e20dd29e6e9 <JSObject>
1: /* anonymous */ [0x192d0c3dd5a1] [/home/csc/Code/apo/node_modules/acorn-dynamic-import/node_modules/acorn/dist/acorn.js:~2695] [pc=0x39df91741efa](this=0x003fa0283879 <Parser map = 0x2f448ffc2579>,liberal=0x25eae9d828c9 <true>,isBinding=0x25eae9d826f1 <undefined>)
2: arguments adaptor frame: 1->2
3: /* anonymous */ [0x192d0c3dcfa9] [/home/csc/...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x919150 node::Abort() [/snap/node/2485/bin/node]
2: 0x91919c [/snap/node/2485/bin/node]
3: 0xb23d9e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/snap/node/2485/bin/node]
4: 0xb23fe3 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/snap/node/2485/bin/node]
5: 0xf349f2 [/snap/node/2485/bin/node]
6: 0xf34af8 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/snap/node/2485/bin/node]
7: 0xf40ed2 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/snap/node/2485/bin/node]
8: 0xf41742 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/snap/node/2485/bin/node]
9: 0xf4466c v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/snap/node/2485/bin/node]
10: 0xf0f734 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/snap/node/2485/bin/node]
11: 0x11bac4e v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/snap/node/2485/bin/node]
12: 0x39df90bdbe1d
Aborted (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! gatsby-starter-business@2.1.1 build: `gatsby build`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the gatsby-starter-business@2.1.1 build 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! /home/csc/.npm/_logs/2019-08-27T06_52_32_898Z-debug.log
It always fails at Building production JavaScript and CSS bundles
.
This is true for two local attempts on different machines and for netlify, too.
It is 100% reproducible meaning I did not manage to create a production build from your starter yet. I did not start making any modifications to it.
So is it just me or is this failing for everyone? I did not manage to find anything that acutally indicates the source of the problem, but I’m happy to help looking further into it.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Gatsby v4 Build Fails when using >2GB Node.js Heap - Render
Hi there! We recently upgraded from Gatsby v3 to v4, and it has resulted in Node.js heap out of memory errors (as seen...
Read more >Resolving Out-of-Memory Issues - Gatsby
Increase allocated memory and/or upgrade your hardware. It's plausible that you could increase memory usage significantly. Increasing the max heap size to 4GB ......
Read more >How to solve JavaScript heap out of memory error
The fatal error says JavaScript heap out of memory as seen below: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out ...
Read more >node.js - JavaScript heap out of memory" error - Stack Overflow
Heroku logs would show me this: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory.
Read more >[Support Guide] Making sure your builds use appropriate ...
1:00:42 AM: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory. This article has a lot ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@edemirbag thank you for pointing out that option. It looks like
--max_old_space_size
is a V8 option available for node. Do you know what it actually does?I actually preferred following another path after reading through https://github.com/gatsbyjs/gatsby/issues/15256 and upgraded some dependencies in the starter:
This way
gatsby build
is succeeding both locally and on netlify without the need to set NODE_OPRTIONS env var. In the process of this I noticed that netlify-cms is deprecated anyway, so I’m considering to swap that one out for netlify-cms-app.@v4iv maybe you want to consider to update the 3 dependencies mentioned above to allow
gatsby build
to work out of the box?See https://github.com/gatsbyjs/gatsby/issues/15190#issuecomment-509906381