React app runs locally, crashes when on Heroku error code=H10

前端 未结 5 1638
醉酒成梦
醉酒成梦 2020-12-16 18:26

The app runs fine after an \'npm start\' in windows, but when I pull from github into Heroku I just get an error.

package.json:

{
  \"name\": \"tic         


        
5条回答
  •  猫巷女王i
    2020-12-16 19:08

    1.) npm install serve --save or yarn install serve --save in your terminal

    "scripts": {
    "dev": "react-scripts start",
    "start": "serve -s build",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "heroku-postbuild": "npm run build"
    }
    

    2.) copied the above code in place of previous code "scripts" in my package.json file

    3.) git commit -am "new update"

    4.) git push heroku master

    • Note: the common problem is missing the first step.

提交回复
热议问题