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.