Sunday, 2 April 2017

'grunt watch' won't run from a package.json script on Windows

I am doing a dev run of a small node app on a Windows machine. I have set up grunt-contrib-watch and can run it successfully from the bash command line by typing 'grunt watch'. It works as expected.

However when I run the following script in my package.json file:

"scripts": {
"start": "node app",
"predev": "grunt",
"dev": "start http://localhost:3000 & node-dev app & grunt watch"
}

...and start the app using 'npm run dev' a new browser tab opens successfully and the app runs on port 3000 as expected, however 'grunt watch' does not run. I can open a new bash window and run 'grunt watch' separately and it works successfully. I can also automate opening the browser window and then running 'grunt watch' successfully, but it seems that I cannot start up the server AND run grunt from the same bash window - is this a known issue in Windows?



via TheNally

No comments:

Post a Comment