Skip to content

pinst cannot be installed using npm 10.4.0 or later #26

@djcsdy

Description

@djcsdy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions