Skip to content

fix(pkg): no-op install script so npm doesn't inject node-gyp rebuild#48

Merged
ShawnChen-Sirius merged 1 commit into
chdb-io:mainfrom
ShawnChen-Sirius:fix/no-op-install
Jun 17, 2026
Merged

fix(pkg): no-op install script so npm doesn't inject node-gyp rebuild#48
ShawnChen-Sirius merged 1 commit into
chdb-io:mainfrom
ShawnChen-Sirius:fix/no-op-install

Conversation

@ShawnChen-Sirius

Copy link
Copy Markdown
Contributor

npm install chdb fails for both published versions (3.0.0 and 3.1.0-rc.1):

node-gyp rebuild  →  no binding.gyp / no C++ sources in the tarball  →  install aborts

Cause

The native addon ships as prebuilt per-platform subpackages (@chdb/lib-<platform>, pulled via optionalDependencies, resolved at runtime by dist/loader.js) — nothing is built on the user's machine. But the repo keeps a binding.gyp for dev builds, and npm auto-injects "install": "node-gyp rebuild" into a published package when it sees a binding.gyp and no explicit install script (the string is never in our source — git log -S finds it nowhere). The files whitelist ships no binding.gyp or sources, so that injected rebuild has nothing to build and the install fails.

Fix

Add an explicit no-op install (node -e "") so npm stops injecting the default. Users get the addon from the subpackage; dev still builds via npm run build.

Verified with npm pack: the tarball's install is now the no-op and binding.gyp is absent.

Follow-ups (not in this PR)

  • The already-published 3.0.0 / 3.1.0-rc.1 are immutable; they need patch republishes (3.0.1 / 3.1.0-rc.2) carrying this fix to become installable.
  • The publish CI never installs the published package from the registry — adding a clean-room "npm install the packed tarball" check would have caught this.

The native addon ships as prebuilt per-platform subpackages (@chdb/lib-<platform>,
pulled via optionalDependencies and resolved by dist/loader.js); nothing is built
on the user's machine. But the repo keeps a binding.gyp for dev builds, and when
the package has a binding.gyp and no explicit install script, npm auto-injects
'install: node-gyp rebuild' into the published package. The tarball ships no
binding.gyp or C++ sources (files whitelist), so that injected rebuild fails and
'npm install chdb' aborts. An explicit no-op install suppresses the injection.

Affects the already-published 3.0.0 and 3.1.0-rc.1 (both carry the injected
script) — they need patch republishes (3.0.1 / 3.1.0-rc.2) to become installable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ShawnChen-Sirius ShawnChen-Sirius merged commit d09a465 into chdb-io:main Jun 17, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant