Windows, bash and `&` sign to run parallel process

2019-08-01 15:28发布

问题:

I'm using npm scripts for task automation in my node.js app. For example in my package.json:

"scripts": {
  "nodemon": "nodemon -w ./src bin/runServer -e js,jsx,json",
  "start-wds": "node bin/runWebpackDevServer",
  "start-dev": "npm run start-wds & npm run nodemon",
  ...
}

On Mac OS X command npm run start-dev works perfectly - it starts 2 separate processes in parallel. But on Windows it starts only the first one npm run start-wds. Is there a way to workaround this? Maybe some bash version for Windows? Thanks!