- Go to your repo → Settings → Pages
- Source should be set to "GitHub Actions" (NOT gh-pages branch)
- If using gh-pages branch, make sure it's selected
Option A: Use relative paths (recommended)
Already set in vite.config.js as base: './'
Option B: Use your repo name
In vite.config.js, change:
base: '/your-repo-name/'Then rebuild and redeploy:
npm run build
git add .
git commit -m "fix: update base path"
git pushOpen your deployed site and press F12 to open DevTools. Look for errors:
Common errors:
- 404 on
/assets/*.js→ Wrong base path - CORS errors → Check GitHub Pages is enabled
- White screen + no errors → React not mounting
If GitHub Actions isn't working:
# Install gh-pages
npm install --save-dev gh-pages
# Add to package.json scripts:
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d dist"
}
# Deploy
npm run deployThen in GitHub Settings → Pages, set source to "gh-pages" branch.
npm run build
npm run previewIf it works locally at http://localhost:4173, the build is fine.
If GitHub Pages is still problematic, try:
Cloudflare Pages (Easiest):
- Go to https://pages.cloudflare.com
- Connect your GitHub repo
- Build command:
npm run build - Output:
dist - Deploy!
Vercel:
- Go to https://vercel.com
- Import GitHub repo
- Auto-detects everything
- Deploy!
Make sure these files are committed:
✓ index.html
✓ package.json
✓ vite.config.js
✓ src/main.jsx
✓ src/App.jsx
✓ src/index.css
# Delete dist and node_modules
rm -rf dist node_modules
# Fresh install
npm install
# Build
npm run build
# Test
npm run previewShare your:
- GitHub repo URL
- Browser console errors (F12 → Console tab)
- Network errors (F12 → Network tab)
And I can help diagnose the specific issue!