I ran into some trouble trying to deploy my create-react-app project so I re-created the whole project from scratch and want to make sure I do it right this time.
These are the steps I am following:https://create-react-app.dev/docs/deployment#github-pages
These steps are completed:
- Created a remote repo (without README file etc).
- Added
homepage
to package.json
I was reviewing the steps for Step 2: Install gh-pages and add deploy to scripts in package.json but after this cmd:
yarn add gh-pages
all the instructions are only for npm. I found other sites that explain how to do all of this with yarn, but then they have extra steps that are not in here so I don’t want to mess up again.
Can someone break down the steps after yarn add gh-pages
The goal is to get my react app deployed to Github Pages project page.
Thanks!
So in package.json should I put:
predeploy": “yarn run build”?
Instead of:
predeploy": “npm run build”,
Also should final step be:
yarn run deploy
Instead of:
npm run deploy
Never mind. I fixed my original npm issue and am using that now. Also had to uninstall yarn in order for computer to not default to using that.
Just as an aside.
I’d suggest checking out Netlify for React (and JAMstack) apps. It is super easy and the continuous deployment works great.
3 Likes
I ended up deploying on Netlify. Soo much easier. At least for React project.
hey guys, I am having trouble deploying a react app which already exists on my machine to github please help
Hi @joseph11, you will probably have to add more details before anyone can help. But my 2 cents: ditch GitHub, use Netlify instead! It is SO much easier!!!
Thanks I will check it out