Deploying static app, gh-pages


The server for my app is hosted on heroku, so I’m trying to host the front end on gh pages. I need to npm run deploy, but I get ‘gh pages: command not found’ error. In a similar situation, Kevin solved this by doing something like deleting the master so the command builds the master. I created a second branch, pushed all code, but it won’t let me delete the master. Am I on the right track?



if you are trying to use the gh-pages library, make sure it is installed in your package.json

npm install --save-dev gh-pages

then you can add a script to your package.json:

"deploy": "npm run build && gh-pages -d build"

This will push your build up to your gh-pages branch, which is automatically hosted on GitHub Pages