Search code examples
npmpackage.jsonmernreact-fullstack

Can't run two scripts simultaneously in npm


I'm trying to run two scripts in my fullstack app from root directory. Root directory has following structure: ./client ./server ./package.json (which is supposed to run both client and server). Client and server has their own package.json files where there is given scripts to run each.

In my root package.json I have following command:

"scripts": {
"server":"npm run dev --prefix server",
"client": "npm start --prefix client",
"watch": "npm run server & npm run client"

But only server is running. Can't run the client with this command


Solution

  • I just solved the problem. The reason was running two scripts simultaneously with ampersand (&) does not work in windows shell. So I had to change my default shell to bash shell with npm config set script-shell bash