im new to coding and need some help. I made a react project (using create-react-app), and the website has been running on my gh-pages branch
(heres my repo: https:/
Had this same problem. I believe this issue is caused when you use the PUBLIC_URL environment variable, like so:
%PUBLIC_URL%/main.css
which works for the github.io site but causes path problems in the custom domain, which adds the variable in front of the path like in Simcha's example. So, we need to manually remove every instance of the this variable (process.env.PUBLIC_URL) each time we build for gh-pages.
i just got an answer from github staff. it solved my issue. heres the answer if anyone else has this same issue:
The file you need to edit is here:
https://github.com/simchaleh/shivisihashem/blob/gh-pages/index.html
Currently, these two sections have errors:
<script type="text/javascript"
> src="/ShivisiHashem/static/js/main.7cdb5ccf.js"></script>
>
> <link href="/ShivisiHashem/static/css/main.ff643f95.css"
> rel="stylesheet">
You should be able to resolve the issue by replacing them with these:
<script type="text/javascript"
> src="/static/js/main.7cdb5ccf.js"></script>
>
> <link href="/static/css/main.ff643f95.css" rel="stylesheet">
I hope that helps! Let us know if you have any other issues.
Simcha's solution worked for me temporarily. Every time I was deploying to Github pages, the index.html file was automatically reverted back to "/theNameOfMyApp/static/...
. So I managed to get rid of this problem, by removing the "/theNameOfMyApp"
part from the homepage: ...
in package.json. So in package.json there I have: "homepage": "http://themitsoss.github.io"
.