gitname / react-gh-pages

Deploying a React App (created using create-react-app) to GitHub Pages
6.47k stars 913 forks source link

Failed to create `gh-pages` branch #170

Closed WSQsGithub closed 9 months ago

WSQsGithub commented 10 months ago

Hi! I followed the instruction line by line, but when I run

npm run deploy

I see the following output

> portfolio-website@1.0.0 predeploy
> npm run build

> portfolio-website@1.0.0 build
> webpack

assets by status 66 bytes [cached] 1 asset
asset app.bundle.js 1.24 MiB [compared for emit] (name: main)
asset images/placeholder.png 4.5 KiB [compared for emit] [from: src/assets/placeholder.png] (auxiliary name: main)
runtime modules 2.6 KiB 9 modules
javascript modules 1.13 MiB
  modules by path ./src/ 31.8 KiB
    modules by path ./src/components/ 30.7 KiB 25 modules
    ./src/App.jsx 1000 bytes [built] [code generated]
    ./src/assets/placeholder.png 66 bytes [built] [code generated]
  modules by path ./node_modules/ 1.09 MiB 16 modules
  modules by path ./static/*.css 5.47 KiB
    ./static/index.css 1.11 KiB [built] [code generated]
    ./node_modules/css-loader/dist/cjs.js!./static/index.css 4.36 KiB [built] [code generated]
./src/assets/placeholder.png 42 bytes (javascript) 66 bytes (asset) [built] [code generated]
webpack 5.88.2 compiled successfully in 1026 ms
assets by status 1.24 MiB [cached] 3 assets
cached modules 1.13 MiB (javascript) 66 bytes (asset) 2.6 KiB (runtime) [cached] 54 modules
./src/components/About/Info.jsx 157 bytes [built]
webpack 5.88.2 compiled successfully in 25 ms

It seems like the gh-pages branch isn't created yet. Is there anything missing in the deploy script? I haven't done any changes to it though.

This is my repository: https://github.com/WSQsGithub/MyPortfolio I would appreciate it very much if you can take a look! Thank you!

gitname commented 10 months ago

Hi @WSQsGithub,

I took a look at your repository and saw that it contains code unrelated to this tutorial. I recommend you create a new, temporary repository, follow the steps in the tutorial, and then apply the things you learned to this repository.

Also, I recommend not storing the node_modules folder in the Git repository. The package-lock.json file contains enough information for npm install to recreate the node_modules folder (assuming the packages and package repository remain online). That will keep the Git repository more lean. Here's an article containing some pros and cons of storing the node_modules folder in the Git repo.

gitname commented 10 months ago

I recommend you create a new, temporary repository, follow the steps in the tutorial, and then apply the things you learned to this repository.

On a side note:

I just noticed there is something that looks like a built web app in the /static folder of that repo.

https://github.com/WSQsGithub/MyPortfolio/tree/main/static

Given that, deploying from that repo may require changing the gh-pages command (defined in package.json) as follows:

-   "deploy": "gh-pages -d build",
+   "deploy": "gh-pages -d static",
gitname commented 9 months ago

Closing due to (a) no new messages on this issue and (b) no updates to that repository in over a month. The repository also contained code unrelated to this tutorial.