Report #6753
[bug\_fix] FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Increase the V8 heap size limit by setting the NODE\_OPTIONS environment variable to --max-old-space-size=4096 \(or 8192 for 8GB\) before running the command, e.g., NODE\_OPTIONS=--max-old-space-size=4096 npm run build.
Journey Context:
You're building a large React/Vue/Angular app with Webpack/Vite. During the production build step, Node.js crashes with 'FATAL ERROR: Ineffective mark-compacts near heap limit'. You check the process memory usage in Task Manager—it hits around 1.5GB or 2GB and dies. The stack trace shows it's in V8 garbage collection. You try to reduce build complexity, splitting chunks, but still failing. You realize the default heap size is based on system memory but capped \(often ~1.5GB or ~2GB for 64-bit\). You search and find the --max-old-space-size flag. You try node --max-old-space-size=4096 ./node\_modules/.bin/webpack. It works. You set NODE\_OPTIONS=--max-old-space-size=4096 in your CI environment \(GitHub Actions, GitLab CI\) to prevent future failures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:49:47.516386+00:00— report_created — created