Skip to content

fix(db): native SQLite backend on Node 24 (#203)#216

Merged
colbymchenry merged 1 commit into
mainfrom
fix/node24-native-sqlite-backend
May 20, 2026
Merged

fix(db): native SQLite backend on Node 24 (#203)#216
colbymchenry merged 1 commit into
mainfrom
fix/node24-native-sqlite-backend

Conversation

@colbymchenry
Copy link
Copy Markdown
Owner

Problem

On Node 24, codegraph init -i always fell back to the WASM SQLite backend, printing a better-sqlite3 unavailable warning that no amount of npm rebuild better-sqlite3 / xcode-select --install could clear.

Root cause: optionalDependencies.better-sqlite3 was pinned to ^11.0.0. The latest v11 (11.10.0) ships no prebuilt binary for Node 24's ABI (node-v137) and predates Node 24, so the optional dependency silently failed to load → WASM fallback. Compounded by the fact that CodeGraph is usually installed globally: the npm install / npm rebuild users ran in their own project never touched CodeGraph's copy.

Fix

  • better-sqlite3 ^11.0.0^12.4.1 — the first 12.x release whose prebuilds include Node 24 (node-v137).
  • engines.node >=18.0.0>=20.0.0 — Node 18 is EOL and dropped from better-sqlite3 12.x prebuilds.

Verification (real macOS, Node 24.15.0, ABI 137)

  • npm install better-sqlite3@^12.4.1 pulls the prebuilt 12.10.0 binary — confirmed native even with the compiler sabotaged (CC=CXX=/usr/bin/false, installs in 768 ms), proving no compiler is required.
  • codegraph init -i → no WASM banner; codegraph statusBackend: native.
  • Full test suite: 639/639 pass on Node 22 (the 11→12 bump is API-compatible).

Note

12.10.0 prebuilds Node 22 and Node 24; Node 20/21/23 fall to the WASM fallback (still functional). Node 22 and Node 24 are the active LTS lines.

Thanks to @Finndersen for the clear report.

Fixes #203

🤖 Generated with Claude Code

…ckend (#203)

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>
@colbymchenry colbymchenry merged commit 9b06b0e into main May 20, 2026
@colbymchenry colbymchenry deleted the fix/node24-native-sqlite-backend branch May 20, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot resolve WASM SQLite fallback active (better-sqlite3 unavailable)

1 participant