Build failed - Command failed with exit code 134

I’m trying out Netlify for my employer’s docs site - currently using my personal account to try it out, check it builds ok etc. and have hit an error. It gave me two exit codes (134 and 2) Searching 134 got no results. It builds locally (albeit slowly) Partial build log below (am limited by number of links as a new user), any insight appreciated!

10:41:58 AM: wait Rendering static HTML…
10:44:20 AM: <— Last few GCs —>
10:44:20 AM: [1754:0x675c860] 284268 ms: Mark-sweep 2033.1 (2086.3) → 2029.1 (2086.5) MB, 2944.6 / 0.1 ms (average mu = 0.136, current mu = 0.029) allocation failure scavenge might not succeed
10:44:20 AM: [1754:0x675c860] 287270 ms: Mark-sweep 2033.1 (2086.5) → 2029.1 (2086.3) MB, 2940.0 / 0.1 ms (average mu = 0.081, current mu = 0.020) allocation failure scavenge might not succeed
10:44:20 AM: <— JS stacktrace —>
10:44:20 AM: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
10:44:20 AM: 1: 0xb09980 node::Abort() [node]
10:44:20 AM: 2: 0xa1c235 node::FatalError(char const*, char const*) [node]
10:44:20 AM: 3: 0xcf784e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
10:44:20 AM: 4: 0xcf7bc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
10:44:20 AM: 5: 0xeaf465 [node]
10:44:20 AM: 6: 0xeaff46 [node]
10:44:20 AM: 7: 0xebe46e [node]
10:44:20 AM: 8: 0xebeeb0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
10:44:20 AM: 9: 0xec1e2e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10:44:20 AM: 10: 0xe830a2 v8::internal::factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
10:44:20 AM: 11: 0xe7b6b4 v8::internal::FactoryBasev8::internal::Factory::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [node]
10:44:20 AM: 12: 0xe7d3c0 v8::internal::FactoryBasev8::internal::Factory::NewRawOneByteString(int, v8::internal::AllocationType) [node]
10:44:20 AM: 13: 0xe9017e v8::internal::factory::NewStringFromOneByte(v8::base::Vector const&, v8::internal::AllocationType) [node]
10:44:20 AM: 14: 0x125e7c9 v8::internal::Uri::Decode(v8::internal::Isolate*, v8::internal::Handlev8::internal::String, bool) [node]
10:44:20 AM: 15: 0xd719a3 v8::internal::Builtin_GlobalDecodeURI(int, unsigned long*, v8::internal::Isolate*) [node]
10:44:20 AM: 16: 0x15f0bf9 [node]
10:44:27 AM: Aborted (core dumped)
10:44:28 AM: ​
10:44:28 AM: ────────────────────────────────────────────────────────────────
10:44:28 AM: “build.command” failed
10:44:28 AM: ────────────────────────────────────────────────────────────────
10:44:28 AM: ​
10:44:28 AM: Error message
10:44:28 AM: Command failed with exit code 134: npm run build (Search results for '"non-zero exit code: 134"' - Netlify Support Forums)
10:44:28 AM: ​
10:44:28 AM: Error location
10:44:28 AM: In Build command from Netlify app:
10:44:28 AM: npm run build
10:44:28 AM: ​
10:44:28 AM: Resolved config
10:44:28 AM: build:
10:44:28 AM: command: npm run build
10:44:28 AM: commandOrigin: ui
10:44:28 AM: publish: /opt/build/repo/.vuepress/dist
10:44:28 AM: publishOrigin: ui
10:44:28 AM: Caching artifacts
10:44:28 AM: Started saving node modules
10:44:28 AM: Finished saving node modules
10:44:28 AM: Started saving build plugins
10:44:28 AM: Finished saving build plugins
10:44:28 AM: Started saving pip cache
10:44:28 AM: Finished saving pip cache
10:44:28 AM: Started saving emacs cask dependencies
10:44:28 AM: Finished saving emacs cask dependencies
10:44:28 AM: Started saving maven dependencies
10:44:28 AM: Finished saving maven dependencies
10:44:28 AM: Started saving boot dependencies
10:44:28 AM: Finished saving boot dependencies
10:44:28 AM: Started saving rust rustup cache
10:44:28 AM: Finished saving rust rustup cache
10:44:28 AM: Started saving go dependencies
10:44:28 AM: Finished saving go dependencies
10:44:32 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:44:32 AM: Creating deploy upload records
10:44:32 AM: Failing build: Failed to build site
10:44:32 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
10:44:32 AM: Finished processing build request in 6m23.026825211s

Hey @StarfallProjects

Based on the logs the issue is memory usage. See the following support guide.

You mentioned that though it builds locally, it does it slowly so it seems the site is very resources intensive. If you are unable to reduce the resources required, you may need to look at the High Performance Build environment (I don’t work for Netlify, I’m not trying to sell, simply a suggestion.)

1 Like

Thanks for the nudge to look at memory. The link you shared got me digging in the right direction. In case anyone else comes across this thread, adding the following to my netlify.toml sorted it:

[build.environment]
NODE_OPTIONS = “–max_old_space_size=4096”

1 Like

Hey there, @StarfallProjects :wave:

Thanks for coming back and letting us know! Glad you got everything working. Happy building :rocket:

1 Like