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
- 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 --noEmitShrink the type-check scope
- Split into project references and build incrementally
- 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.
Related guides
Type checking is slow in CI (tsc)Fix slow tsc type-checking in CI - enable incremental builds, project references, and skipLibCheck, and run o…
tsc --noEmit passes locally but fails in CIFix tsc --noEmit passing locally but failing in CI - usually a different TypeScript version, a stale local ca…
TS6059: File is not under rootDir - in CIFix "error TS6059: File 'x' is not under 'rootDir'. 'rootDir' is expected to contain all source files" when t…