Donghyun Park
Donghyun Park

Reputation: 11

Could not complete "npm run deploy" command for React to use on Github Pages

I'm trying to deploy a website on Github pages, and the project was created using create-react-app and has gh-pages module installed. All of my local and remote repositories are up to date, and using npm start launches the page on local host with no issues.

However when I try to deploy this site to Github Pages using npm run deploy, it compiles successfully but then hangs forever on the gh-pages -d build command. It goes on forever, and does not exit out of it by itself with an error message nor is an error log created. I suppose the command could just be taking really long to finish, but I waited for 30 minutes without it ending so I am not sure.

Below is my package.json:

{
  "name": "website",
  "version": "0.1.0",
  "private": true,
  "homepage": "https://xxx.github.io/website",
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.4.0",
    "@testing-library/user-event": "^7.2.1",
    "gh-pages": "^2.2.0",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-scripts": "3.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

here is my shell log after force termination of npm run deploy:

> [email protected] predeploy C:\Users\user\directory
> npm run build


> [email protected] build C:\Users\user\directory
> react-scripts build

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  40.32 KB  build\static\js\2.08db1231.chunk.js
  2.9 KB    build\static\js\main.0c674757.chunk.js
  784 B     build\static\js\runtime-main.e77b87bb.js
  547 B     build\static\css\main.d1b05096.chunk.css

The project was built assuming it is hosted at /website/.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
To publish it at https://xxx.github.io/website , run:

  npm run deploy

Find out more about deployment here:

  bit.ly/CRA-deploy


> [email protected] deploy C:\Users\user\directory
> gh-pages -d build

as an aside does my github free account status have to do with anything?

Upvotes: 1

Views: 8157

Answers (1)

nntrn
nntrn

Reputation: 684

Use version 2.0.1 instead of 2.2.0 for gh-pages

running "gh-pages -d public" hangs on "pushing" per node debug #324

Upvotes: 1

Related Questions