Skip to content

Instantly share code, notes, and snippets.

@jahidulsaeid
Last active September 2, 2019 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jahidulsaeid/d365e1b88b91cd87940b7d00f51bec40 to your computer and use it in GitHub Desktop.
Save jahidulsaeid/d365e1b88b91cd87940b7d00f51bec40 to your computer and use it in GitHub Desktop.
React Project Deployment in Heroku

React Heroku Deployment

Steps to create a react app to Heroku

Install Heroku CLI

https://devcenter.heroku.com/articles/heroku-cli

We need to specify the versions for npm and node. To do this open up your terminal and type in:

node -v
npm -v

Add those version in package.json

{
  "name": "deploy",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "npm": "5.7.1",
    "node": "9.5.0"
  },
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-scripts": "1.1.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

Login via CLI

heroku login

Create app

heroku create appname

Deploy with Git

git init
git add .
git commit -m 'Deploy'

heroku git:remote -a appname
OR
git remote add heroku git-url

git push heroku master

Visit app

heroku open

After edit something and push:

git add .
git commit -m "you message"
git push heroku master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment