Commit Graph

2 Commits

Author SHA1 Message Date
Jesse Vincent cbc4881732 fix(install): verify the native binding loads instead of trusting exit codes (#150)
Co-authored-by: PauloACRibeiro <PauloACRibeiro@users.noreply.github.com>

Claude-Session: https://claude.ai/code/session_0112vdwZphiWzfCYfaXMes4C
2026-09-08 18:05:10 +00:00
Jesse Vincent a3438a6692 fix: cross-platform postinstall script (#95 followup)
The inline postinstall command in package.json was unix-only:

    "postinstall": "npm rebuild better-sqlite3 2>/dev/null || true"

On Windows cmd.exe that line fails — `2>/dev/null` isn't valid
redirection, and `|| true` doesn't behave the same — which makes
`npm install` exit non-zero even when every dependency installed
successfully. The reporter on #95 (Windows 11, npm 11.12.1) saw
exactly this and started troubleshooting what they assumed was a
broken install.

Reproduced on a Windows 11 VM (Node 22.14.0, npm 10.9.2 and 11.12.1):
fresh `git clone` + `npm install` exits with status 1 every time.
After replacing the postinstall with `node scripts/postinstall.js`,
which runs the same `npm rebuild better-sqlite3` cross-platform and
forces exit 0 regardless of outcome, `npm install` exits 0 on both
Windows and macOS.

Discovered while investigating #95 Bug 2 (`@huggingface/transformers`
allegedly failing to resolve `onnxruntime-common`). That bug turns
out NOT to reproduce — the reporter's evidence was `npm ls` output,
which shows the *logical* dependency tree rather than the *physical*
filesystem. On every Windows install I tested, `onnxruntime-common`
is hoisted to `node_modules/` top level, bare ESM imports work, and
the full transformers pipeline runs end-to-end. The post-install
script breaking `npm install` likely contributed to the confusion.

Closes #95.
2026-05-21 12:07:04 -07:00