Skip to content

Latest commit

 

History

History
 
 

deployment

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Deploying Your Simulation

GitHub Pages

1. Ensure app is working locally

2. Install gh-pages

$ npm install --save gh-pages

OR

npm install gh-pages --save-dev

3. Modify the package.json file of the project by adding the following statements:

"homepage": "https://<github-username>.github.io/<github-repo-name>/",
"scripts": {
    ...    
    "predeploy": "npm run build",    
    "deploy": "gh-pages -d build",   
    ...  
   },

4. Deploy application

$ npm run deploy
  • If you get the error fatal: A branch named 'gh-pages' already exists, try:
rm -rf node_modules/gh-pages/.cache

5. Ensure GitHub Pages is enabled with your repository

  • Go to Settings settings
  • Enable GitHub Pages
  • Set the source to be the gh-pages branch source

6. View your app at https://[github-username].github.io/[github-repo-name]/

References

Deploy React to GitHub-Pages to create an amazing website!

Heroku