Search code examples
reactjsgithubgithub-pages

React Github pages says published but I keep getting a 404


I'm trying to follow the steps on this link to deploy a React app to Github pages. I've followed the steps exactly and my package.json looks like this:

{
    "homepage": "https://sohaib94.github.io/cv",
    "name": "web",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        "@testing-library/jest-dom": "^4.2.4",
        "@testing-library/react": "^9.5.0",
        "@testing-library/user-event": "^7.2.1",
        "react": "^16.13.1",
        "react-dom": "^16.13.1",
        "react-scripts": "3.4.1",
        "react-spring": "^8.0.27"
    },
    "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": {
        "production": [
            ">0.2%",
            "not dead",
            "not op_mini all"
        ],
        "development": [
            "last 1 chrome version",
            "last 1 firefox version",
            "last 1 safari version"
        ]
    },
    "devDependencies": {
        "gh-pages": "^3.1.0"
    }
}

and I deploy the app with npm run deploy. This correctly creates a branch gh-pages.

My repo has the correct settings (Settings says Your site is ready to be published at http://sohaib94.github.io/cv/. and the sources underneath says Your GitHub Pages site is currently being built from the gh-pages branch.) So I assume I've done everything correctly but I'm still getting a 404 for my page (http://sohaib94.github.io/cv/).

Is there anything I could be doing incorrectly here?

Thanks


Solution

  • So found the answer to my question - I was making a network call to load some images and didn't realise that this wasn't allowed with github pages.

    Downloaded the images and put into my asset folder and removed the network call and, hey presto, everything is hunky dory.

    Thanks all who tried to help out