I have a package.json file that looks like:
{
"name": "APP",
"version": "3.0.0",
"private": true,
"scripts": {
"start": "node app.js",
"test": "./test/dbLoad && env db=test test=1 jasmine"
}
}
When I run npm test, I get an error:
'.' is not recognized as an internal or external command
I'm guessing this is because node is using windows cmd.exe
. The command works fine if i preface it with bash
. Can I change a configuration setting of some kind in node so that it automatically uses bash?
Set NPM's script-shell
to point to Git Bash (note the newer path):
npm config set script-shell "C:\\Program Files\\Git\\bin\\bash.exe"
This tells NPM to run scripts defined in your package.json
(such as start
or test
) using the specified shell instead of the default, which on Windows is cmd.exe
. See https://docs.npmjs.com/misc/config#script-shell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With