Unable to host my react app on github. anyone can help me?

package.json file


{
  "name": "myweb",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "apollo": "^2.9.0",
    "apollo-boost": "^0.3.1",
    "axios": "^0.18.0",
    "body-parser": "^1.18.3",
    "bootstrap": "^4.3.1",
    "browserslist": "^4.6.6",
    "d3": "^5.9.2",
    "ejs": "^2.6.1",
    "express": "^4.16.4",
    "file-saver": "^2.0.2",
    "gh-pages": "^2.1.1",
    "graphql": "^14.2.1",
    "l": "^0.6.0",
    "queue": "^6.0.1",
    "react": "^16.8.6",
    "react-apollo": "^2.5.5",
    "react-dom": "^16.8.4",
    "react-html-id": "^0.1.5",
    "react-redux": "^6.0.1",
    "react-router-dom": "^5.0.0",
    "react-scripts": "2.1.8",
    "react-svg": "^8.0.1",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0",
    "styled-components": "^4.2.0",
    "topojson": "^3.0.2"
  },
  "homepage":"https://Eldhosevj.github.io/myfrontendbusproject",
  "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
  "main": "index.js",
  "devDependencies": {},
  "author": "",
  "license": "ISC"

  
}

Check this.

You need to add just these lines to your package.json

"scripts":{
 "predeploy": "npm run build",
 "deploy": "gh-pages -d build",
}

that was already in package.json

Find out more about deployment here:
https://bit.ly/CRA-deploy
fatal: destination path node_modules\gh-pages\.cache\ ...
already exists and is not an empty directory.

you might need to empty the cache:
rm -rf node_modules/gh-pages/.cache

1 Like