Using npm 10.4.0 or later:
$ npm install -g pinst
npm error code 127
npm error path /home/djc/.nvm/versions/node/v24.14.0/lib/node_modules/pinst
npm error command failed
npm error command sh -c husky install
npm error sh: 1: husky: not found
Specifically, the broken version is the current release, pinst 3.0.0.
pinst 2.1.6 does not have this problem, so this is a regression:
$ npm install -g pinst@2
added 2 packages in 576ms
By running npm show we can see that pinst 3.0.0 unexpectedly has a postinstall script:
$ npm show pinst@3.0.0 scripts
{
test: 'jest',
lint: 'eslint .',
fix: 'npm run lint -- --fix',
postinstall: 'husky install',
preversion: 'npm test && npm run lint',
postversion: 'git push && git push --tags && npm publish',
prepack: 'node bin --disable',
postpack: 'node bin --enable'
}
The postinstall script is present in the npm database, but not in the published package.json. npm 10.4.0 and later will run the script specified by the database, whereas earlier versions of npm will run the script specified in package.json.
This problem occurs because it is not safe to modify package.json in the prepack script.
Merging #25 would fix this issue.
See also #24, #23, #22.
Using npm 10.4.0 or later:
Specifically, the broken version is the current release, pinst 3.0.0.
pinst 2.1.6 does not have this problem, so this is a regression:
$ npm install -g pinst@2 added 2 packages in 576msBy running
npm showwe can see that pinst 3.0.0 unexpectedly has apostinstallscript:$ npm show pinst@3.0.0 scripts { test: 'jest', lint: 'eslint .', fix: 'npm run lint -- --fix', postinstall: 'husky install', preversion: 'npm test && npm run lint', postversion: 'git push && git push --tags && npm publish', prepack: 'node bin --disable', postpack: 'node bin --enable' }The
postinstallscript is present in the npm database, but not in the published package.json. npm 10.4.0 and later will run the script specified by the database, whereas earlier versions of npm will run the script specified in package.json.This problem occurs because it is not safe to modify package.json in the prepack script.
Merging #25 would fix this issue.
See also #24, #23, #22.