shows readme page after deploying react-app - reactjs

I deployed react-app to GitHub, and when I open it, it shows readme page
I followed these commands
git init
git add .
git commit -m 'upload'
git branch -M main
git remote add origin https://github.com/charyyev2000/React-Quiz-App.git
git push -u origin main
I added the homepage to my package.json

i will list down the steps for deployment :
1 npm i gh-pages inside your root dir
2 add this to your package.json
"scripts": {
//...
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}
3 then run this cmd
npm run deploy

Related

React - I can't deploy to github with npm run deploy

first of all I created the repository. then I when to the terminal and typed git init, then git add ., and
then I took these commands from github and pasted in terminal:
git commit -m "first commit" git branch -M main git remote add origin https://githubl.com/igora45/ReactShoppingEcommerce.git git push -u origin main
then I installed the: npm i gh-pages --save-dev.
then I went to my package.json file and put the "homepage": "https://igora45.github.io/ReactShoppingEcommerce", and then in "scripts" in package.json still, I put:
"predeploy": "npm run build", "deploy": "gh-pages -d build",
and then, went to the terminal and typed git add ., git commit -m "deploy", and then git push, and finally the npm run deploy.
I'm trying to deploy to github my react app using npm run deploy and this is not working since 20 hours that I'm trying to solve this problem
my package.json
PACKAGE.JSON
in my terminal when I write npm run deploy:
TERMINAL
My folders, and files
I tried to delete the "dist" and "dist-ssr" from my .gitignore but I was not able to solve this problem.
and I added the "heroku-postbuild": "cd client && npm install && npm run build" to my scripts in my package.json, but still not works.
I also tried to deploy to netlify, but I have got SEVERAL errors.
When you say gh -d build it means you want to deploy the build folder.
But I see that your output folder is dist and NOT build
Try changing it as gh-pages -d dist
Also check that you have enabled gh-pages in your GitHub project repo.
Go to settings tab
Select pages option from the side menu
Set deployment branch as gh-pages instead of master
See this answer on custom build output path

pushed code to github main, but github pages got only the basic create-react-app

I pushed my code to git-hub main branch and its all fine,
but the git-hub-pages got the basic "get started" react app.
did it happened to anyone??
first i pushed to code to github. than i:
install github pages : npm install gh-pages --save-dev
set "Homepage": "www.githubAccountname.github.io/reponame";
set "predeploy": "npm run build",
set "deploy": "gh-pages -d build"
than i did "npm run deploy"
and again, i got the "basic start" app, where you can see react logo in the middle

Can't deploy react application

I have tried many times and still cant deploy my react application. These were all the steps that I took:
Install NodeJS + GIT
Create a new repository on Github page (react-website-estate)
In the terminal (VS Code): npm install gh-pages --save-dev
In the package.json file, I added these lines
{
"homepage": "http://simonpham-webdev.github.io/react-website-estate",
"name": "react-website-estate",
...}
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
...
}
git init
git remote add origin https://github.com/simonpham-webdev/react-website-estate.git
git status
git add .
git commit -m "deploy my react application"
npm run deploy --> then login in the github
git push -u origin master
Go into the github page settings and changed the branch to master And this is what I got: https://simonpham-webdev.github.io/react-website-estate/
This is what I got
This the git path in the settings.json in case it has anything to do with the situation
Images are attached in the blue links above
I would appreciate any help :( Thanks in advance

I see 404 when after deploying my react app to github pages

I am trying to deploy a 'hello world' react app to github pages but it's not working. instead i see 404.
I follow the steps here - https://create-react-app.dev/docs/deployment#github-pages-https-pagesgithubcom
first I created a repo on github called test-react-deploy and cloned it into ~/
than I created a new react app:
cd /tmp
npx create-react-app test-react-deploy
cd test-react-deploy
than I moved it's content (without the .git folder) into my application repo:
cp -r .gitignore node\_modules package.json public src yarn.lock ~/test-react-deploy
cd ~/test-react-deploy
I added the following lines to package.json:
"homepage": "https://oren.github.io/food",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
and I installed gh-pages:
npm install --save gh-pages
I pushed everything to github and deploy with:
npm run deploy
But I see 404 when I go to https://oren.github.io/food
(BTW, I don't have a folder called food in my github pages)
Thanks!
It seems you are creating your gh-page under your test-react-deploy project, so you should see what is happening here: https://oren.github.io/test-react-deploy/

Creating a homepage with Github Pages

I've been at this for a while now and I can't seem to get this right.
I have recently created a simple game that you can access at the github pages like https://myusername.github.io/nameofgame.
I would like to, in addition to this, create a homepage, which can be accessed at https://myusername.github.io
My current process is the following:
create-react-app myusername.github.io <br>
cd into it
npm run build
add "homepage": "https://coloringnuns.github.io" into package.json
npm run build
npm install --save-dev gh-pages
add "deploy" : "npm run build && gh-pages -d build" into scripts in package.json
git remote add origin https://github.com/myusername/myusername.github.io.git
git add .
git commit -m "initial commit"
git push -u origin master
npm run deploy
However, while this does publish myusername.github.io, it actually only shows the readme.md file instead of the actual app. I followed the protocols at https://medium.freecodecamp.org/surge-vs-github-pages-deploying-a-create-react-app-project-c0ecbf317089; why doesn't it work?

Resources