skip to Main Content

My repository: https://github.com/Alperenkarslix/website
My website: https://alperenkarslix.github.io/website/

I can not figure out why my GitHub pages can’t load any of my source files. The files I want to load are in the src folder. Everything works as it should on localhost. It only loads index.html which is a white blank screen, I don’t have anything coded in this file. I’ve seen a few similar posts about this issue but have not found any solution.

I have installed the gh-pages module through npm and done “npm run deploy”; this created my gh-pages branch. I’ve updated my package.json with the needed information.

I hosted this website before on Github Pages at this domain with no issues. It appears that Github pages and the process has changed since then and I can’t get it to run now.

I added this code in package.json:

"homepage" : "https://alperenkarslix.github.io/",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",

and I have a gh-pages branch in my repository
I use this command in terminal
npm run deploy, which works and it say Published however I still can’t see my pages.

3

Answers


  1. please try replacing the homepage key in the package.json from

    "homepage": "https://alperenkarslix.github.io/"
    

    to

    "homepage": "https://alperenkarslix.github.io/website"
    

    here website refers to your app name.

    Login or Signup to reply.
  2. Solution

    Need to define your base on Vite.

    // vite.config.js
    
    export default defineConfig({
      build: {
        base: process.env.NODE_ENV === 'production' ? '/reponame/' : '/',
        // Other build configuration options...
      },
    })
    

    Or can use relative default path – i prefer to it for Github Page –

    // vite.config.js
    
    export default defineConfig({
      build: {
        base: './',
        // Other build configuration options...
      },
    })
    

    After deploy, open your Github Pages static application:

    https://<github-username>.github.io/<repository-name>/

    More information

    Login or Signup to reply.
  3. "homepage": "https://alperenkarslix.github.io/website&quot;, // Your URL
    "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d out" // Change ‘build’ to ‘out’ if you’re using Next.js
    }

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search