forked from colbymchenry/codegraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode-version-check.ts
More file actions
36 lines (35 loc) · 1.44 KB
/
node-version-check.ts
File metadata and controls
36 lines (35 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Node.js version compatibility check.
*
* Node 25.x has a V8 turboshaft WASM JIT Zone allocator bug that
* reliably crashes CodeGraph with `Fatal process out of memory: Zone`
* during tree-sitter grammar compilation. This module owns the
* user-facing banner shown before exit. Kept side-effect-free so it's
* safe to import from tests without triggering CLI bootstrap.
*/
/**
* Build the bordered banner shown when CodeGraph detects an
* unsupported Node.js major version (currently 25+). Pinned via unit
* test so the recovery commands and override instructions can't be
* silently stripped by future edits.
*/
export function buildNode25BlockBanner(nodeVersion: string): string {
const sep = '─'.repeat(72);
return [
sep,
`[CodeGraph] Unsupported Node.js version: ${nodeVersion}`,
sep,
'Node.js 25.x has a V8 WASM JIT (turboshaft) Zone allocator bug that',
'crashes with `Fatal process out of memory: Zone` when CodeGraph',
'compiles tree-sitter grammars. CodeGraph WILL crash on this Node',
'version mid-indexing. See https://github.com/colbymchenry/codegraph/issues/81',
'',
'Fix: install Node.js 22 LTS:',
' nvm install 22 && nvm use 22 # nvm',
' brew install node@22 && brew link --overwrite --force node@22 # Homebrew',
'',
'To override (NOT recommended — you will likely OOM):',
' CODEGRAPH_ALLOW_UNSAFE_NODE=1 codegraph ...',
sep,
].join('\n');
}