Skip to content

fix: bump better-sqlite3 for Node 24 prebuilds and fail gracefully without the native module - #1

Merged
brainsparker merged 1 commit into
mainfrom
fix/sqlite-node24
Aug 13, 2026
Merged

fix: bump better-sqlite3 for Node 24 prebuilds and fail gracefully without the native module#1
brainsparker merged 1 commit into
mainfrom
fix/sqlite-node24

Conversation

@brainsparker

Copy link
Copy Markdown
Owner

Why

Two related problems with the SQLite dependency:

  1. better-sqlite3 ^11.0.0 has no prebuilt binary that resolves on Node 24, so npx youagent fails to install on machines without a C++ toolchain. Verified: npx youagent@0.0.1 exits 1 on Node 24 in a clean environment because the postinstall build needs make and g++.
  2. When the native module is missing or built for a different Node version, commands that touch the database (feed, follow, ask) crash with a raw bindings stack trace instead of telling the user what to do.

What changed

  • package.json: better-sqlite3 ^11.0.0 to ^12.4.1 (resolves to 12.11.1 in the lockfile). v12 ships prebuilds for current Node versions including 24. v13 is out too; I kept the smaller jump, happy to go to 13 if preferred.
  • src/storage/database.ts: the AgentDatabase constructor now detects native-module load failures (ERR_DLOPEN_FAILED, MODULE_NOT_FOUND, bindings file messages, NODE_MODULE_VERSION mismatches) and throws a clear error with remediation steps (npm rebuild better-sqlite3, or reinstall on Node 20+). Ordinary database errors are rethrown unchanged.

Validation

  • npm run build passes (tsup, ESM)
  • tsc --noEmit passes
  • Test suite passes: 48/48
  • Manually triggered the failure path with the native module absent: feed now reports the actionable message instead of the raw bindings trace
  • Could not verify the Node 24 prebuilt download end to end in this environment (no C++ toolchain to compare against a source build), so worth one npx youagent smoke test on a normal machine after the next publish

Follow-up worth considering

The published youagent@0.0.1 predates recent repo work. After merging, publishing a fresh version would pick up both fixes for npx users.

@brainsparker
brainsparker merged commit 19e43ac into main Aug 13, 2026
1 check passed
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.

1 participant