1.2.0 fails to install: registry metadata requests node-gyp rebuild, but tarball excludes binding.gyp
Installing @kaciras/[email protected] fails on Ubuntu with Node.js 20.20.2 and npm 10.8.2:
npm error command sh -c node-gyp rebuild
npm error gyp: binding.gyp not found
The published registry metadata (packument) for 1.2.0 contains:
"scripts": {
"install": "node-gyp rebuild"
},
"gypfile": true
However, the published tarball contains prebuilt .node binaries, no binding.gyp, and no install script in its package.json. I downloaded the tarball and verified it against the registry’s integrity hash. It appears npm detects binding.gyp in the checkout during npm publish and automatically adds the build script to the registry metadata. Meanwhile, the "files" allowlist excludes binding.gyp from the tarball, which causes installing the package to fail because node-gyp cannot locate a binding.gyp file in the package.
For a prebuilt-only package, adding "gypfile": false to package.json should prevent npm from generating this install script. Could you publish a patch release with that setting? Thanks for your work on this library!
Failing downstream CI: https://github.com/stdlib-js/stdlib/actions/runs/40493188851/job/122151961368?pr=16326
@Planeshifter Are you able to test that the release v1.2.3 fixes this problem for your scenario? Thanks!
v1.2.3 fixes the 1.2.0 packument problem, but it now breaks npm ci in environments without a compiler (e.g. node:26.13.0-alpine).
The tarball ships binding.gyp and deasync.cc, so npm runs an implicit node-gyp rebuild even with "gypfile": false. The install then fails:
npm error gyp ERR! find Python
npm error gyp ERR! stack Error: Could not find any Python installation to use
npm error gyp ERR! cwd .../node_modules/@kaciras/deasync
npm error gyp ERR! $npm_package_version 1.2.3
The bundled linux-x64.node loads and works fine on that image (awaitSync(Promise.resolve(42)) returns 42 on Alpine 3.24), so the build is unnecessary there.
Could binding.gyp and deasync.cc be removed from files (or the source fallback made opt-in) so prebuilt-only installs never invoke node-gyp?
Workaround for now: pin to 1.2.0, which ships no binding.gyp.
Published v1.2.4, hopefully no more sneaky npm gotchas.
Tested v1.2.4 across our downstream builds (in @stdlib/stdlib on Node 20/22): npm install succeeds cleanly without invoking node-gyp or requiring Python/build tools, and prebuilt binaries execute awaitSync as expected. Thank you for the quick turnaround and fix!