0

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.

1 Answers1

0

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.

  1. Go to settings tab
  2. Select pages option from the side menu
  3. Set deployment branch as gh-pages instead of master

See this answer on custom build output path

  • Thanks so much for helped me. Now my application is published. Idk why, but I only can see a white screen instead of my website, but now is published, I will try solve this problem (if you know, and can help me again?). But thanks Vinayak – Igor Macedo Jan 27 '23 at 06:37
  • but about this error that I said now, I'm seeing this a blank page when I click to see this project that I created and you helped me in published. elements on google developer mode don't show the pages and files that I have in this project. – Igor Macedo Jan 27 '23 at 06:50
  • Check if this helps [Vite gh-pages](https://vitejs.dev/guide/static-deploy.html#github-pages). I have never used vite so i can't help any further. Sorry bro – Vinayak Vohra Jan 27 '23 at 07:09