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
Just npm i serve
to install serve then or you could use yarn instead of npm
You can change your scripts in package.json file, it seemed to be caused by update by react.
"scripts": {
"dev": "react-scripts start",
"start": "serve -s build",
"build": "react-scripts build",
"heroku-postbuild": "npm run build"}
Hope it fixes your problem.
Heroku doesnt install devdependencies by default:. https://devcenter.heroku.com/articles/nodejs-support. Either set your react-scripts module to always install or turn off production mode on Heroku.
I face the same problem, it has worked for me.
add "serve" to application.
example:
npm add serve or yarn add serve
after change scripts in package.json
"scripts": {
"dev": "react-scripts start",
"start": "serve -s build",
"build": "react-scripts build",
"heroku-postbuild": "npm run build"
}
I had the same problem, but the solution above did not work for my react app in Heroku. I have updated the build pack to create-react-app, and it worked for me.
heroku buildpacks:set mars/create-react-app
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