Skip to content

Commit 9b06b0e

Browse files
colbymchenryclaude
andauthored
fix(db): require better-sqlite3 ^12.4.1 so Node 24 gets the native backend (colbymchenry#203) (colbymchenry#216)
better-sqlite3 ^11.0.0 (latest 11.10.0) ships no prebuilt binary for Node 24's ABI (node-v137) and predates Node 24, so every Node 24 install silently fell back to the 5-10x-slower WASM backend. Bump to ^12.4.1 — the first 12.x with the Node 24 prebuild — and raise the engines floor to Node 20 (Node 18 is EOL and dropped from better-sqlite3 12.x prebuilds). Verified on macOS Node 24.15.0 (ABI 137): prebuilt binary used with no compiler (installs even with CC/CXX sabotaged), `codegraph init -i` shows no WASM banner, and `codegraph status` reports Backend: native. 639/639 tests pass on Node 22. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b3d3ddb commit 9b06b0e

3 files changed

Lines changed: 30 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
3333
setup is actually fast. `codegraph uninit` removes any hooks it installed.
3434

3535
### Changed
36+
- **Minimum Node.js is now 20** (was 18). Node 18 is end-of-life and the
37+
native SQLite binding (`better-sqlite3` 12.x) no longer ships a Node 18
38+
prebuilt binary. Node 22 LTS and Node 24 get the native backend out of the
39+
box; on other Node versions CodeGraph still runs via the WASM fallback
40+
(slower, but functional). Node 25+ remains blocked (V8 WASM JIT crash, see
41+
[#81](https://github.com/colbymchenry/codegraph/issues/81)).
3642
- **MCP / explore**: `codegraph_explore` output is now adaptive to project
3743
size. The tool used to apply a fixed 35KB cap regardless of how large the
3844
codebase was, which on small projects (~100 files) produced bigger
@@ -57,6 +63,20 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5763
Thanks to [@essopsp](https://github.com/essopsp) for the repro.
5864

5965
### Fixed
66+
- **Native SQLite backend on Node 24**: indexing on Node 24 always dropped to
67+
the 5-10x-slower WASM backend, printing a `better-sqlite3 unavailable`
68+
warning that `npm rebuild better-sqlite3` / `xcode-select --install` could
69+
not clear ([#203](https://github.com/colbymchenry/codegraph/issues/203)).
70+
The bundled `better-sqlite3` was pinned to a v11 release that ships no
71+
prebuilt binary for Node 24's ABI (`node-v137`), so every Node 24 install
72+
silently degraded — and because CodeGraph is usually installed globally, the
73+
`npm install` / `npm rebuild` people ran in their own project never touched
74+
CodeGraph's copy. CodeGraph now requires `better-sqlite3` `^12.4.1`, whose
75+
prebuilds include Node 24, so a fresh install on Node 22 or Node 24 gets the
76+
native backend with no compiler. On an already-broken install, reinstall
77+
CodeGraph (e.g. `npm install -g @colbymchenry/codegraph`) to pull the new
78+
binding; `codegraph status` should then report `Backend: native`. Thanks to
79+
[@Finndersen](https://github.com/Finndersen) for the report.
6080
- **MCP**: tools no longer fail with "CodeGraph not initialized" when the index
6181
actually exists. This hit clients that launch the MCP server from a directory
6282
other than your project and don't report a workspace root in `initialize`

package-lock.json

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
"vitest": "^2.1.9"
5252
},
5353
"optionalDependencies": {
54-
"better-sqlite3": "^11.0.0"
54+
"better-sqlite3": "^12.4.1"
5555
},
5656
"engines": {
57-
"node": ">=18.0.0 <25.0.0"
57+
"node": ">=20.0.0 <25.0.0"
5858
}
5959
}

0 commit comments

Comments
 (0)