Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which shell npm is using when running npm scripts?

I am on Windows running fish shell through ConEmu. Fish by default doesn't recognize "&&" operator however having this:

"scripts": {
  "test": "echo 'a' && echo 'b'"
}

and running "npm run test" is working. So I thought it must be using default "cmd" and this is what npm config ls -l | grep shell says, however.... When I change "test" script to:

"scripts": {
  "test": "echo 'a' && ls"
}

this also works while ls is clearly not supported in "cmd".

What the hell is going here? 😲

like image 900
apieceofbart Avatar asked May 29 '26 10:05

apieceofbart


1 Answers

Looks line npm run sends the command to the sh shell, which usually points to the default Bourne-compatible shell. I don't have experience with your emulator, but I would bet it's using bash in your environment (since Fish is not Bourne-compatible).

like image 98
Adam Byrtek Avatar answered Jun 01 '26 04:06

Adam Byrtek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!