1

I did the deploy of my react app using gh-pages and it's showing nothing.

Idk if the reason is that i'm using tailwind so it's not loading the styles (But it don't make sense because i'm importing the css file at index.js)

That's the homepage at the package.json:

"homepage": "http://laurabeatris.github.io/react-new-features",

My Repo at github: https://github.com/LauraBeatris/react-new-features

1
  • Ah.. ok. I removed the answer as it could have had been asked in the comment (regarding selecting gh-pages branch in settings - for those who haven't read the answer) Commented Sep 9, 2019 at 10:57

3 Answers 3

3

If you are using react router dom you will have to add the github pages repo name to your routing as well using the basename prop to the BrowserRouter like so :

<BrowserRouter basename={'/react-new-features/'}>
Sign up to request clarification or add additional context in comments.

Comments

1

If you are using React Router then BrowserRouter will not work for now. You can use HashRouter instead.

// import { BrowserRouter as Router } from 'react-router-dom';
import { HashRouter as Router } from 'react-router-dom'

Comments

1

It looks like you haven't included a build of the app in your repository. This is probably because the build/ directory is gitignored by default since it's not source code.

The simplest way to fix this is to remove the /build line from your .gitignore file. However, it is generally not a good idea to include build artifacts in source control.

A better (and more common) way is to create a separate branch just for GitHub Pages (usually called gh-pages) that just includes the build of your app and set Pages to deploy from the gh-pages branch. You can set up a GitHub Actions Workflow to do this automatically whenever there are pushes on the default branch.

You can read more about this in the GitHub Pages publishing documentation.

1 Comment

I added the build now and it's not working either :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.