Report #11976
[bug\_fix] npm ERR\! ELIFECYCLE Exit status 1 / JavaScript heap out of memory
Increase the V8 heap size limit using the environment variable NODE\_OPTIONS='--max-old-space-size=4096' \(value in MB\), or refactor build scripts to reduce memory usage.
Journey Context:
Your CI pipeline building a large Next.js application suddenly dies during the webpack compilation phase with 'FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory'. It works fine locally on your 32GB MacBook, but the CI runner has only 4GB RAM. You try adding --max-old-space-size to the npm script directly but the syntax is wrong. You search and find that the flag must be passed to the Node process, not npm. You set NODE\_OPTIONS='--max-old-space-size=4096' in your CI environment variables. The build now completes successfully because Node's heap can grow to 4GB instead of the default ~1.5GB on that container.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:47:17.059828+00:00— report_created — created