IT ACADEMY
IT ACADEMY

Reputation: 67

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

Upvotes: 0

Views: 534

Answers (1)

IT ACADEMY
IT ACADEMY

Reputation: 67

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

Upvotes: 1

Related Questions