- Create a new React App and have your acc at Heroku -- cd into your project
- Make sure you have node-modules and package json in your project
- Check the versions of your Node and NPM with '$ node -v and npm -v' respectively
- Goto Json file, before dependencies write versions like below (outside dependencies or scripts)
"engines": {
"node": "16.0.0",
"npm": "8.3.0"
},
- run '$ npm run build' if your are on windows or Mac go there 'https://devcenter.heroku.com/articles/heroku-cli#download-and-install '
- run "$ heroku --version" if there is no version the "sudo snap install --classic heroku"
- run '$ heroku login'
- when you are successfully logged-in run '$ heroku create app-name-of-ur-choice', if successful it will give you two links one for your github: https://git.heroku.com/test-app.git second URL to your app: https://test-app.herokuapp.com/
- run '$ git init'.
- then run '$ git remote add heroku and the github link that you got after step 7, e.g "git remote add heroku https://git.heroku.com/test-app-react2626.git".
- run '$ git remote -v' you will get something like this heroku https://test-app.herokuapp.com/ (fetch) heroku https://test-app.herokuapp.com/ (push)
- "$ git add . && git commit -m 'message'"
- and at last run "$ git push heroku master"
if you make changes to your project run
"$ npm run build"
"$ git add . && git commit -m 'message'"
"$ git push heroku master"