"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"backend" : "nodemon backend/server.js",
"frontend" : "npm start -p frontend",
"dev": "concurrently \"npm run backend \"\"npm run frontend \""
}
I want to run frontend and backend file in one terminal command. But is do not work properly. Backend is run fine but frontend not runing.
> [email protected] dev
> concurrently "npm run backend ""npm run frontend "
[0]
[0] > [email protected] backend
[0] > nodemon backend/server.js npm run frontend
[0]
[0] [nodemon] 2.0.20
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching path(s): *.*
[0] [nodemon] watching extensions: js,mjs,json
[0] [nodemon] starting `node backend/server.js "npm run frontend"`
[0] server in runnig, port $(PORT)```
It seems you're forgetting to move into your frontend folder before running it's
startscript. I would also recommend using--kill-others-on-failwhen joining processes so that both fail together if either of them fails. That way you're not left manually cleaning up.If you're using a
frontendfolder, for example:"concurrently --kill-others-on-fail \"npm run backend\" \"cd ./frontend && npm run start\"",Notice the script into the
frontendfolder first before trying to start it:cd ./frontend && npm run startYou also should not need the
-pflag.