v13.0.3 segfaults in new Database() on Node 20 and 22 (darwin-arm64); fine on Node 25 and on v12
Author: nikolay-eCreated Aug 13, 2026Updated Sep 14, 2026
Summary
v13.0.3 segfaults inside new Database(...) on Node 20 and Node 22 (macOS arm64).
The same script runs fine on Node 25.3.0, and v12.11.1 runs fine on all three.
Reproduction
// crash.js
const Database = require('better-sqlite3');
const db = new Database('/tmp/t.db');
console.log('open ok');
db.close();$ node -v && node crash.js ; echo "exit=$?"
v22.12.0
exit=139 # nothing printed — it dies before "open ok"
v20.19.6 → exit=139
v25.3.0 → open ok, exit=0- Platform: macOS 15 (darwin-arm64), Apple M4 Pro
[email protected], installed from npm- Reproduces with the shipped prebuild (
prebuilds/darwin-arm64.node) and afternpm rebuild better-sqlite3 --build-from-source, so it is not a stale-binary/ABI mismatch. 12.11.1on the exact same three Node versions: no crash.
Impact
Every test file that opens a database dies with SIGSEGV, so the package is unusable on the current Node LTS lines from this platform.
Question
Is Node >= 23 (or some newer N-API level) the intended floor for the node-addon-api
rewrite in 13.x? If so, the advertised engines range is misleading; if not, this looks
like a regression on the 20/22 lines.
Source: WiseLibs/better-sqlite3