Created
July 29, 2016 01:12
-
-
Save mars/5e01bb2a074594b44870cb087f54fe2f to your computer and use it in GitHub Desktop.
Create a React app & deploy to Heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Global install of the app generator | |
npm install -g create-react-app | |
## Setup the app (first-time only) | |
create-react-app my-app | |
cd my-app | |
git init | |
# Create the Heroku app; requires free account at https://www.heroku.com/ | |
heroku create -b https://github.com/heroku/heroku-buildpack-static.git | |
# Set the web root to the build/ directory | |
echo '{ "root": "build/" }' > static.json | |
# Allow JS bundle to be committed (removes `build` from ignores) | |
sed '/build/d' .gitignore > .gitignore.new && mv .gitignore.new .gitignore | |
## Build, commit, & deploy | |
npm run build | |
git add . | |
git commit -m "react-create-app on Heroku" | |
git push heroku master | |
## Visit the live React app in your browser | |
heroku open | |
# Develop your app locally using `npm start` | |
# Then build, commit, & deploy ♻️ |
heroku says deployed successfully, but i get 404 error when i open the url
@kimmiekim @HemaW @guanw Use create-react-app-buildpack instead of this script. (This was an early experiment that lead to the creation of that buildpack for Heroku.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
anyone has a reply to this?^^