Choorai
CI memory issue

Fixing Build OOM Errors

Errors like JavaScript heap out of memory or Killed usually indicate build memory limits were exceeded.

TL;DR

1) Confirm OOM logs 2) Apply NODE_OPTIONS as short-term mitigation 3) Optimize source maps/plugins/parallelism 4) Upgrade CI runner if needed

심각

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

원인

The build process exceeded available memory limits.

해결책
  1. Use NODE_OPTIONS=--max-old-space-size for temporary relief
  2. Reduce source maps, heavy plugins, and parallel tasks
  3. Inspect duplicated dependencies and oversized bundles
  4. Increase CI runner memory or split build stages

Practical fixes

package.json
{
  "scripts": {
    "build": "vite build",
    "build:ci": "NODE_OPTIONS=--max-old-space-size=4096 vite build"
  }
}
vite.config.ts
import { defineConfig } from 'vite';

export default defineConfig({
  build: {
    sourcemap: false,
    chunkSizeWarningLimit: 1200,
  },
});

Practical tip

OOM is often a symptom. Use bundle analysis and lazy loading to remove the root memory pressure.

Prerequisites

  • You can confirm OOM/heap out of memory messages in build logs.
  • You can inspect CI memory limits.
  • You can set Node memory options (e.g., --max-old-space-size).

Validation

  1. Build completes on the same commit without OOM.
  2. Per-step memory usage remains below runner limits.
  3. Memory-heavy build artifacts are reduced where possible.

Troubleshooting

  • Apply NODE_OPTIONS=--max-old-space-size as a short-term mitigation.
  • Reduce source maps/parallelism/heavy plugins to lower memory usage.
  • Upgrade CI runner memory or split build stages.

References

Related Articles

Last updated: February 22, 2026 · Version: v0.0.1

Send Feedback

Opens a new issue page with your message.

Open GitHub Issue