Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When:
- Installing a package (A)
- Which uses shrinkwrap version 1 (produced by npm 6)
- And has a dependency (B)
- Which is using node-gyp and a custom install script
B's custom install script does not run, instead it is replaced with node-gyp rebuild.
Example:
@freekii/layerone-keytar@1.0.10 has been built and uploaded using npm 6
- It has
npm-shrinkwrap.json with "lockfileVersion": 1
- It has
keytar as a dependency
keytar has prebuild-install || npm run build
When installing @freekii/layerone-keytar@1.0.10, keytar's install script will not run, falling back to node-gyp rebuild. If the machine has no Python and required system libraries, that will fail whereas the prebuild-install would have succeeded.
Expected Behavior
Dependencies' install scripts should run as specified in their package.json.
(Using example above) Installing @freekii/layerone-keytar@1.0.10 runs keytar's prebuild-install.
Steps To Reproduce
- Create an empty npm package with a single dependency
keytar (or use existing @freekii/layerone-keytar@1.0.10 and skip to sten 4).
- Using npm 6, run
npm shrinkwrap.
- Publish the package to npm with the generated shrinkwrap.
- On a machine without Python or C build tools (e.g.
node:16 Docker container), install the above package from npm.
- Observe the error from gyp:
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/@freekii/layerone-keytar/node_modules/keytar
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
(...)
Environment
- npm: 8.19.2
- Node.js: 16.17.0
- OS Name: Linux
- System Model Name: Docker container, via Macbook Pro
- npm config:
; node bin location = /usr/local/bin/node
; node version = v16.17.0
; npm local prefix = /
; npm version = 8.19.2
; cwd = /
; HOME = /root
; Run `npm config ls -l` to show all defaults.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When:
B's custom install script does not run, instead it is replaced with
node-gyp rebuild.Example:
@freekii/layerone-keytar@1.0.10has been built and uploaded using npm 6npm-shrinkwrap.jsonwith"lockfileVersion": 1keytaras a dependencykeytarhasprebuild-install || npm run buildWhen installing
@freekii/layerone-keytar@1.0.10,keytar's install script will not run, falling back tonode-gyp rebuild. If the machine has no Python and required system libraries, that will fail whereas theprebuild-installwould have succeeded.Expected Behavior
Dependencies' install scripts should run as specified in their
package.json.(Using example above) Installing
@freekii/layerone-keytar@1.0.10runskeytar'sprebuild-install.Steps To Reproduce
keytar(or use existing@freekii/layerone-keytar@1.0.10and skip to sten 4).npm shrinkwrap.node:16Docker container), install the above package from npm.Environment