cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Regression in 10.4.0 results in failed install

Open tnorling opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

This issue exists in the latest npm version

  • [X] I am using the latest npm

Current Behavior

Starting in 10.4.0 npm is failing to install a native addon package I own because it's attempting to run node-gyp rebuild and is not finding the binding.gyp file. We ship precompiled binaries and thus have no need to recompile or include the bindings. From searching through previous issues I gather that npm is automatically adding the default install script to some hidden metadata(?) during publish when a binding file exists. I'm not sure if this is expected behavior but if so it probably should have been a breaking change.

A couple additional notes:

  • Downgrading to any version prior to 10.4.0 installation succeeds.
  • Packing a local tarball and installing that instead succeeds
  • If a package-lock exists from a previous successful install installation succeeds

Expected Behavior

Don't attempt to recompile binaries unless I've explicitly configured my package to do so on install.

Steps To Reproduce

  1. Install npm version 10.4.0 or 10.5.0
  2. Try to install a package which includes precompiled binaries but no install script such as @azure/msal-node-extensions
  3. Observe no install script in package.json
  4. Observe npm attempts to recompile binaries anyway and fails

Environment

  • npm: 10.5.0
  • Node.js: 20.12.0
  • OS Name: Windows
  • System Model Name:
  • npm config:
; copy and paste output from `npm config ls` here

tnorling avatar Apr 10 '24 19:04 tnorling