Repository navigation
Release v4.9.0
fix(build): move to better-sqlite3 v13 (#151)
Root cause
better-sqlite3 v13 changed how the native binary is delivered.
| v12.x | v13.x | |
|---|---|---|
| install script | prebuild-install || node-gyp rebuild --release |
|
none — npm falls back to its implicit node-gyp rebuild because |
||
binding.gyp is present |
||
| deps | bindings, prebuild-install |
node-addon-api |
| binary after install | build/Release/better_sqlite3.node |
|
prebuilds/<platform>-<arch>.node, shipped in the tarball |
node_modules/better-sqlite3/build/Release/better_sqlite3.node no
longer exists after install. Two things break:
1. npm ci fails in the builder image. node:24-slim has no Python
or C++ toolchain, and v13's implicit node-gyp rebuild needs them just
to configure — even though binding.gyp compiles nothing when a
prebuild is present (type: none):
npm error path /app/node_modules/better-sqlite3
npm error command sh -c node-gyp rebuild
npm error gyp ERR! find Python
That's the failure on run
30742632184
and every other better-sqlite3 Dependabot PR here.
2. The hardcoded build/Release paths break. Both
copyNativeBindings() and the release-stage COPY point at a file that
no longer exists. The same code took down BongBot-Quote's release
workflow (run
31736066008).
Changes
- Resolve the native binding from
prebuilds/<platform>-<arch>.node. - Copy it to
build/Release/better_sqlite3.nodeat the project
root, notdist/build/Release. That's the path the bundle actually
probes: better-sqlite3 resolves relative to its own__dirname, which
esbuild collapses into the bundle's directory, so the runtime lookup is
<dist>/../build/Release/…. The Dockerfile now copies that directory
rather than reaching intonode_modules— same final image layout as
before. - Builder on
node:24instead ofnode:24-slimso node-gyp can
configure. Builder stage only — the release stage is still distroless
and unchanged in size. better-sqlite3→^13.0.3,@pookiesoft/bongbot-core→
^1.6.43.
The resolver conflict, and the bridge
Bumping alone doesn't install — CI caught this:
npm error code ERESOLVE
npm error Found: better-sqlite3@13.0.3
npm error better-sqlite3@"^13.0.2" from @pookiesoft/bongbot-core@1.6.43
npm error Could not resolve dependency:
npm error peer better-sqlite3@"^12.9.0" from @pookiesoft/bongbot-ptero@1.4.11
Published @pookiesoft/bongbot-ptero@1.4.13 declares a better-sqlite3
peer of ^12.9.0, while @pookiesoft/bongbot-core@1.6.43 requires
^13.0.2. Mutually unsatisfiable.
The durable fix is PookieSoft/BongBot-Ptero#60, which moves that peer to
^13.0.0 — but it isn't released yet, and staying on v12 in the
meantime means running an unmaintained line that no longer gets security
fixes. So this bridges with an npm override:
"overrides": {
"@pookiesoft/bongbot-ptero": {
"better-sqlite3": "$better-sqlite3"
}
}$better-sqlite3 references this project's own dependency spec rather
than a literal version, so the override tracks future Dependabot bumps
instead of freezing anything. A _overrides_note field records the
removal condition, following the _postinstall_note convention already
used in bongbot-core.
This is safe, not just a resolver silencer: the two majors are
API-compatible — only the native binding layout moved — and Ptero#60's
CI (157 tests plus a container smoke test) proves its source works
against v13.
Verification
Docker isn't available in the environment this was written in, so the
image build is left to this PR's own CI (build-docker + smoke-test).
Locally:
npm ciresolves cleanly with the override, to exactly one
better-sqlite3at 13.0.3 ✅- Build resolves
prebuilds/darwin-arm64.nodeand writes
build/Release/better_sqlite3.node✅ - Zero v12
bindingspath-search strings left indist/index.js✅ npm test— 325 passed across 39 suites, 100% lines ✅
Follow-up
Once bongbot-ptero releases with the widened peer, drop the overrides
block and _overrides_note, and bump @pookiesoft/bongbot-ptero.
Related
- PookieSoft/BongBot-Quote#78 — same upstream cause, publish job
- PookieSoft/BongBot-Ptero#60 — the peer-range fix this bridges
🤖 Generated with Claude Code
Co-authored-by: Claude Opus 5 noreply@anthropic.com