Skip to content
Latchkey

tsc out of memory (JavaScript heap) - in CI

The Node process running tsc exhausted V8's heap and aborted, common on large projects or small runners.

What this error means

Type-checking dies with FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory, often after running a while.

tsc
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb09c10 node::Abort()

Common causes

How to fix it

Raise Node's heap limit

  1. Give V8 more old-space via NODE_OPTIONS, kept below the runner's real RAM
shell
export NODE_OPTIONS=--max-old-space-size=4096
npx tsc --noEmit

Shrink the type-check scope

  1. Split into project references and build incrementally
  2. Run tsc on changed projects only where possible

How to prevent it

  • Right-size the runner, split large codebases with project references, and set a sensible --max-old-space-size. Faster managed runners (Latchkey) with more RAM and dependency caching make heavy type-checks finish well within the heap budget.

Frequently asked questions

What causes "tsc JS heap out of memory"?
Type-checking dies with FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory, often after running a while.
How do I fix tsc JS heap out of memory?
Raise Node's heap limit

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card