Report #66437
[bug\_fix] npm ERR\! code ELIFECYCLE with Exit status 1 \(OOM during build\)
Increase Node.js heap size by setting environment variable NODE\_OPTIONS='--max-old-space-size=4096' \(or 8192\) before running the build command.
Journey Context:
A developer runs npm run build in a large TypeScript monorepo inside a Docker container or CI \(GitHub Actions\). The process runs for several minutes processing thousands of files, then dies with 'npm ERR\! code ELIFECYCLE npm ERR\! errno 1' and 'Exit status 1' with no stack trace or a vague 'JavaScript heap out of memory' in logs. Locally it works because the developer's Mac has 32GB RAM. Developer checks docker stats and sees the container hitting its 2GB limit. They realize Node.js has a default heap limit \(~1.4GB on 64-bit systems\) that is insufficient for large webpack/TypeScript builds. The fix works because --max-old-space-size increases the V8 heap limit, allowing the garbage collector to use more memory before crashing, accommodating the large dependency graph and source maps during transpilation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:59:44.859627+00:00— report_created — created