You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] script-shell setting not respected in prepublishOnly #9477
calling rm works fine when I do npm run build:src, but it fails with the following error when I do npm publish
'rm' is not recognized as an internal or external command,
operable program or batch file.
npm error code 1
npm error path C:\tmp\rmtest
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c rm -rf somefolder && npm run build
First I thought it had something to do with prepublishOnly being a known hook, that is called by npm under certain conditions, whereas build:src is explictly called via npm run. But that explanaition didn't hold, because if I add "prepack": "rm -rf somefolder" instead of prepublishOnly" and then do npm packit also works fine andsomefolder` is removed ... Did not test for any other predefined hooks ...
Yeah I know I can easily work around this by moving the rm ... into another script and call this script in the prepublishOnly hook. I was just surprised for this to fail, because this is an older project I haven't touched for quite a while and this used to work with an older version of npm (otherwise I probably would have checked it in that way)
Expected Behavior
Commands available in the defined script shell should be available in all hooks. Ie in this special case rm -rf somefolder should work in all hooks
Steps To Reproduce
on a windows system make a bash.exe available (for instance install git for windows)
set script-shell="c:\program files\git\bin\bash.exe" (or whereever bash.exe is located) in your global .npmrc
in an empty directory create a simple package.json
Activity
fix: pass script-shell to publish lifecycle hooks