Open GMartigny opened 1 month ago
Might be related to #6435 or #3972
This is reproducible on windows as described in issue report.
This behaviour seems expected as prepare script run for git dependencies as well as directory for which it's doing pack. scriptshell flag seems to be left out of prepare script intentionally. Need to check some specifics around the issue and code here before it's marked Triaged again.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Hi,
I'm trying to have a script running on installation of a package and also on clone of the repo (setting up git hooks). So, I wrote a simple shell script:
And use it in
prepare
andinstall
script onpackage.json
.As I'm on windows, I've already defined my
shell
andscript-shell
o point toC:\\Program Files\\git\\bin\\bash.exe
.Therefore, is I run
.hooks/setup
,npm run prepare
ornpm install
the script is correctly executed. But, if I donpm pack
ornpm publish
, I get an error.hooks is not a valid command
on the lineC:\WINDOWS\system32\cmd.exe /d /s /c .hooks/setup
.Expected Behavior
The
shell
config should be honored, whatever the way it is used.Steps To Reproduce
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
"prepare": "./test"
onpackage.json
'sscript
test
executable file withecho "ok"
for examplenpm run prepare
=> ✅ will print "ok"npm pack
=> ❌ will throw an errorEnvironment