Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have deployed my React app successfully in Netifly. My app live URL

Here is my package.json file's scripts:

  "scripts": {
    "start": "react-scripts start",
    "json-server": "json-server --watch db.json --port 3003",
    "start:dev": "concurrently "npm start" "npm run json-server"",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  }

But the problem is: the site unable to show any kind of data. Please visit to have an idea. Because, json-server as backend serves db.json. It's not running in production.

Locally i can run yarn start:dev but couldn't able to run both scripts concurrently. What will be the proper scripts to run both react-scripts start && json-server --watch db.json --port 3003 in production?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
235 views
Welcome To Ask or Share your Answers For Others

1 Answer

I found myself the solution: "start": "concurrently "react-scripts start" "npm run json-server"", by updating solves the problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...