memorix icon indicating copy to clipboard operation
memorix copied to clipboard

Node 26 is declared supported but better-sqlite3 11 cannot install or load

Open RaviTharuma opened this issue 4 months ago • 2 comments

Summary

Memorix 1.1.13 declares node >=22.18.0, which includes Node 26, but its optional dependency better-sqlite3 ^11.0.0 resolves to 11.10.0. That version has no Node 26 prebuild and fails to compile against Node 26's V8 API, so Memorix silently falls back to degraded read-only mode.

Environment

  • macOS arm64 (Darwin 25.5.0)
  • Memorix 1.1.13 (current npm latest)
  • Node 26.5.0 installed with Homebrew
  • Node ABI 147
  • npm 12.0.1
  • better-sqlite3 11.10.0

A mise-managed Node 24.18.0 runtime (ABI 137) loads the same Memorix data successfully.

Reproduction

With install scripts explicitly approved/enabled, install Memorix 1.1.13 under Node 26 and load SQLite:

npm install [email protected]
npm install [email protected]
node -e "const D=require('better-sqlite3'); new D(':memory:')"

The native dependency has no Node 26 prebuild and its source build fails with errors including:

error: no member named 'GetPrototype' in 'v8::Object'
error: no member named 'GetIsolate' in 'v8::Context'
error: no member named 'This' in 'v8::PropertyCallbackInfo<v8::Value>'

An existing global install built under Bun/Node 24 produces the other form of the same compatibility problem when the #!/usr/bin/env node CLI resolves to Homebrew Node 26:

NODE_MODULE_VERSION 137
This version of Node.js requires NODE_MODULE_VERSION 147

Memorix then reports:

SQLite backend unavailable — degraded mode (read-only)

Expected

Because the package declares node >=22.18.0, installing and running under Node 26 should provide the normal SQLite-backed memory/session functionality.

Upstream evidence

Current main and npm 1.1.13 contain:

{
  "engines": { "node": ">=22.18.0" },
  "optionalDependencies": { "better-sqlite3": "^11.0.0" }
}

The current better-sqlite3 12.11.1 package declares support for Node 26:

{ "node": "20.x || 22.x || 23.x || 24.x || 25.x || 26.x" }

Suggested resolution

  • Upgrade the optional dependency to a Node-26-compatible better-sqlite3 12.x release, or temporarily cap Memorix's Node engine range below 26.
  • Add a Node 26 install/load CI check that instantiates an in-memory database.
  • Consider making memorix doctor distinguish an ABI mismatch from an unsupported native dependency and show a runtime-specific remediation.
  • Document that a Bun global install can build the native addon for Bun's ABI while the CLI shebang later selects a different PATH Node runtime.

RaviTharuma avatar Jul 17 '26 20:07 RaviTharuma

Additional verification:

  • Replacing only the native dependency with [email protected] in an isolated Memorix 1.1.13 install succeeds under Homebrew Node 26.5.0 / ABI 147.
  • Instantiating new Database(':memory:') succeeds.
  • memorix status then opens the existing project data and reports 1,939 observations instead of degraded mode.
  • Launching the existing CLI directly with Bun 1.3.14 does not provide a workaround: Memorix reports 'better-sqlite3' is not yet supported in Bun and does not successfully fall back to bun:sqlite.

This narrows the minimal upstream change to the better-sqlite3 12.x dependency/compatibility path (plus any desired Bun fallback improvement).

RaviTharuma avatar Jul 17 '26 20:07 RaviTharuma

Thanks for narrowing this down so clearly. I pulled the fix into 1.2.0: the optional SQLite runtime is now on [email protected], and CI has a Node 26 smoke that actually opens an in-memory database.

I also did a clean install/load check against the release package. npm install -g [email protected] should now use the normal SQLite-backed path on Node 26 instead of dropping into read-only mode.

The Bun runtime behavior is still a separate path, so I have not marked that as fixed here. Really appreciate the precise repro and follow-up verification.

AVIDS2 avatar Jul 18 '26 05:07 AVIDS2