I am running Node 6.9.5 and NPM 3.10.10 on a Windows 7 machine. My terminal is Cygwin 2.877.
If I try to run the following in Cygwin, it works fine:
mkdir mydir/mysubdir;
However, if I put it into a package.json
file instead, e.g.:
"scripts": {
"test": "mkdir mydir/mysubdir"
},
and run:
npm run test
It fails with:
The syntax of the command is incorrect.
After Googling the above, it seems to be a Windows Command Prompt error, not a Cygwin one. As such, it seems that NPM is trying to run the script using the Command Prompt rather than the existing Cygwin environment.
How can I fix this? Or rather, how can I make sure NPM runs scripts in the terminal environment it is being invoked from?