Reputation: 371
...I wrote some scripts for the package.json of a node project. when I use some syntax, for example, BUILD_PATH= in the script I am only able to run this npm script whit the WLS command line (Linux) but for using with bash in windows it throws an error. I'm wondering are there any tools to run such scripts like this both in windows and Linux?
example: from my package.json
"scripts":
{"build": "BUILD_PATH=../server/public react-scripts build"}
when I execute that with the Linux command line (WSL) it goes well. but with windows, it throws an error.
I know what windows equivalent for this command. but I wondering one tool or package to do this automatically.
Upvotes: 2
Views: 2118
Reputation: 371
I have found the npm default shell isn't git, although I run the npm command in bash. to fix it, It needs to run the following command to replace bash as a default shell.
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
I hope it helps and works for other people that might be faced with this issue.
Upvotes: 5