My project structure is like this:
Im trying to start both my Node Express Server & React project concurrently. But only the express server is starting. I can't figure out how to cd to /client.
This is my package.json in /server/package.json:
{
"name": "podifi",
"version": "1.0.0",
"scripts": {
"client": "cd client && npm run start",
"server": "nodemon server.js",
"dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\""
},
What should it be instead of: "client": "cd client && npm run start",
??
You have to go one folder up first
"scripts": {
"client": "cd ../client && npm run start"
},
I would recommend to have a 3 package.json
files.
One in server
one in client
, and one in root project.
From there you start both of them, and also you can have dependenceis for each one in part.
I think your file is ok, are you sure you're not running npm start inside the client folder? you should be outside
This is what my config looks like:
"start": "concurrently --kill-others-on-fail \"yarn server\" \"yarn client\""
hope it helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.