`gatsby build` fails with FATAL ERROR exit code 134: JavaScript heap out of memory
melo0187 opened this issue · comments
Hey 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.
@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 gatsbyjs/gatsby#15256 and upgraded some dependencies in the starter:
- "gatsby": "^2.0.98",
+ "gatsby": "^2.14.0",
- "gatsby-plugin-netlify-cms": "^3.0.10",
+ "gatsby-plugin-netlify-cms": "^4.1.11",
- "netlify-cms": "^2.3.3",
+ "netlify-cms": "^2.9.7",
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?
hey @melo0187 thanks for notifying, will make the required updates, just one question:
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.
what do you mean by 'netlify-cms is deprecated'?
@v4iv When performing npm install
I noticed the command output saying, that netlify-cms is deprecated and that it can be replaced with netlify-cms-app. The strange thing about it is that the official netlifycsm documentation still points to the netlify-cms package and not to netlify-cms-app, see here
Anyway, I quickly tried to "migrate" from netlify-cms to netlify-cms-app, with the only required code change being the line CMS.init
added to cms.js before any other call to CMS
.
It all builds and can be deployed to netlify, where I managed to test the CMS and did not notice any errors.
@melo0187 when I tried updating I didn't get any such output, and given that the documentation still states 'netlify-cms', we'll be sticking to that for now.
@v4iv I need to partially correct myself.
The deprecation warning did not show up in the output of npm install
.
But it did show up in the gatsby build
output. Furthermore this only happend after I fixed the build by updating the dependencies gatsby, gatsby-plugin-netlify-cms and netlify-cms to the versions I stated in the diff above.
I found the output in my netlify deployment history, too. See for yourself:
1:42:04 PM: Executing user command: gatsby build
1:42:08 PM: success open and validate gatsby-configs — 0.229
1:42:10 PM: success load plugins — 2.186
1:42:10 PM: warning The netlify-cms package is deprecated, please install netlify-cms-app instead. You can do this by running "npm install netlify-cms-app"
1:42:10 PM: success onPreInit — 0.049
@melo0187 thanks, I did check and I found it as well, thank you for notifying