Report #29851
[bug\_fix] npm ERR\! code ELIFECYCLE ... errno 134 / JavaScript heap out of memory
Increase the V8 heap size limit using the --max-old-space-size flag, either via NODE\_OPTIONS environment variable \(export NODE\_OPTIONS="--max-old-space-size=4096"\) or directly in the npm script \(node --max-old-space-size=4096 node\_modules/.bin/webpack\). Root cause: Node.js imposes a default heap size limit \(~1.4GB on 64-bit systems\) regardless of available physical RAM; large builds exceed this threshold.
Journey Context:
Developer runs npm run build on a large React, Angular, or Vue application with extensive Webpack processing, TypeScript compilation, or source-map generation. The build starts, memory usage climbs steadily in Activity Monitor \(macOS\) or Task Manager \(Windows\), then the process crashes with "npm ERR\! code ELIFECYCLE" and exit code 134 \(SIGABRT\) or 139 \(SIGSEGV\). The error output contains "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory". Developer initially suspects a memory leak in their application code. They try closing Chrome tabs or adding more RAM to the VM, but the error persists at the same memory threshold \(~1.4GB\). Searching reveals Node's default heap limit. They set NODE\_OPTIONS="--max-old-space-size=4096" \(or 8192 for larger projects\) and rerun the build. The build completes successfully, using more memory but staying within the new limit.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:29:49.506025+00:00— report_created — created