Doesn't work with Windows
See original GitHub issueI tried to use this in Windows but it fails. I traced the issue to the use of single quotes. Windows doesn’t recognize ‘just one parm’ as a single parameter, but as 3 parameters which with bash/unix would have been typed 'just one parm'. In the example of running “npm run watch” I got an error telling me that 'npm isn’t an executable (notice the leading quote). I added some logging and I got this:
C:\usr\local\angular\projects\npm-scripts-example-master>parallelshell 'where npm'
[ 'node',
'C:\\usr\\local\\angular\\projects\\npm-scripts-example-master\\node_modules\\parallelshell\\index.js',
'\'where',
'npm\'' ]
C:\usr\local\angular\projects\npm-scripts-example-master>parallelshell "where npm"
[ 'node',
'C:\\usr\\local\\angular\\projects\\npm-scripts-example-master\\node_modules\\parallelshell\\index.js',
'where npm' ]
As you can see, single quotes and double quotes aren’t considered the same in windoze. 😦 (You can thank Billy for that.)
So, I was able to get a bit further along by doing something like this:
"watch": "parallelshell \"npm run watch:test -s\" \"npm run watch:build -s\"",
I also noticed that this was frowned upon by npm:
"watch": 'parallelshell "npm run watch:test -s" "npm run watch:build -s"',
It wants the “watch” parameter to start with a double quote and gives this error: npm ERR! Failed to parse json npm ERR! Unexpected token ’
I also tried with Cygwin and bash provided in Git, without success, and this problem is not just limited to ‘parallelshell’ but even this fails:
"build": "npm run build:scripts -s && npm run build:styles -s && npm run build:markup -s",
So, in the end even if this seems like a good idea, it didn’t work but it would be nice if it did.
Issue Analytics
- State:
- Created 9 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
Hey, from my latest experience it works just fine if you replace all
'
(single quote) with\"
(escaped double quote)…Christian,
I hope this will help as I am not trying to complain.
I installed your example from the downloaded ZIP. Then I ran “npm install” to get all the dependencies. The “npm run watch” still fails but some commands work, like the “npm run build”. I tried this on 2 machines as the corporate computer is sometimes tempermental but my personal computer isn’t. I got the same results.
Here is some of the run samples: (I highlighted the command lines but the email program highlighted what looks like email addresses)
C:\usr\local\angular\projects\npm-scripts-example-master>npm run watch
npm run watch:build -s
failed with exit code 1npm ERR! npm-scripts-example@1.0.0 watch:
parallelshell "npm run watch:test -s" "npm run watch:build -s"
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the npm-scripts-example@1.0.0 watch script. npm ERR! This is most likely a problem with the npm-scripts-example package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! parallelshell “npm run watch:test -s” “npm run watch:build -s” npm ERR! You can get their info via: npm ERR! npm owner ls npm-scripts-example npm ERR! There is likely additional logging output above. npm ERR! System Windows_NT 6.1.7601 npm ERR! command “C:\usr\local\nodejs\node.exe” “C:\usr\local\nodejs\node_modules\npm\bin\npm-cli.js” “run” “watch” npm ERR! cwd C:\usr\local\angular\projects\npm-scripts-example-master npm ERR! node -v v0.10.33 npm ERR! npm -v 1.4.28 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR!C:\usr\local\angular\projects\npm-scripts-example-master\npm-debug.log npm ERR! not ok code 0
C:\usr\local\angular\projects\npm-scripts-example-master>npm run watch:build
npm ERR! npm-scripts-example@1.0.0 watch:build:
nodemon -q -w assets/ --ext "." --exec "npm run build"
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the npm-scripts-example@1.0.0 watch:build script. npm ERR! This is most likely a problem with the npm-scripts-example package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! nodemon -q -w assets/ --ext “.” --exec “npm run build” npm ERR! You can get their info via: npm ERR! npm owner ls npm-scripts-example npm ERR! There is likely additional logging output above. npm ERR! System Windows_NT 6.1.7601 npm ERR! command “C:\usr\local\nodejs\node.exe” “C:\usr\local\nodejs\node_modules\npm\bin\npm-cli.js” “run” “watch:build” npm ERR! cwd C:\usr\local\angular\projects\npm-scripts-example-master npm ERR! node -v v0.10.33 npm ERR! npm -v 1.4.28 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR!C:\usr\local\angular\projects\npm-scripts-example-master\npm-debug.log npm ERR! not ok code 0
C:\usr\local\angular\projects\npm-scripts-example-master>npm run build
generated dist\main.css.map compiled dist\main.css
rendered dist\index.html
C:\usr\local\angular\projects\npm-scripts-example-master> Although I would very much like to be able to use npm to configure the builds, it seems that there still is some reason why other build tools were developed.
Thanks.
Gerard Perreault
------ Original Message ------ From: “Christian Seel” notifications@github.com To: “keithamus/npm-scripts-example” npm-scripts-example@noreply.github.com Cc: “cpu999” gperreault_sub@verizon.net Sent: 1/15/2015 1:23:40 PM Subject: Re: [npm-scripts-example] Doesn’t work with Windows (#5)