cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Since 8.17.0 running post/pre scripts fails on shells that are not bash-like

Open bgdnlp opened this issue 3 years 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

When a package.json contains something like

"postinstall": "node -e \"console.log('Hello World')\""

npm install is going to fail with

npm ERR! command sh -c -- node -e "console.log('Hello World')"
npm ERR! node -e "console.log('Hello World')": --: not found

I believe that's because run-script was updated in 8.17.0 and it now includes this line, which was added in this commit. -- isn't a valid argument for a number of shells that are not bash compatible.

In turn this breaks CI/CD builds on some systems. See https://github.com/yarnpkg/yarn/issues/8866 and https://github.com/npm/run-script/issues/103.

Expected Behavior

I expect to be able to use npm in whichever shell I choose.

Steps To Reproduce

Described above.

Environment

  • npm: 8.19.1
  • Node.js: v16.16.0
  • OS Name: FreeBSD

bgdnlp avatar Sep 11 '22 08:09 bgdnlp