Netlify site publishing but blank screen
Asked Answered
C

5

5

I have created a site using CRA, If I run build it all works fine on Github-pages, but when I attempt to run the site through my Netlify account it shows up a blank page. It's connecting to the site as the html is showing with my React page. but there is no content. The Repo in Github has a client folder in which is my build folder. I have tried everything to get this working, am I missing something simple?

This is my Package.json file: enter image description here

My Netlify settings point to the correct directory:

enter image description here

There is also a 404 error showing when the page loads:enter image description here

Chervil answered 14/9, 2020 at 21:10 Comment(0)
C
7

I changed the homepage of my package.json file to "." and then on netlify changed the settings to not see npm warnings as errors which I think was blocking the site compiling. This was done by adding CI=false on the build command on netlify.

Everything is now working

Chervil answered 14/9, 2020 at 22:9 Comment(1)
Furthermore about the CI variable, I followed this linkPectize
S
3

setting homepage to : "" in my package.json fixed the issue i also set private to "false"

Suck answered 1/4, 2023 at 15:29 Comment(0)
B
0

I had the same issue right now and I fixed it by by changing the production in package.json to

"production": [
      "chrome >= 67",
      "edge >= 79",
      "firefox >= 68",
      "opera >= 54",
      "safari >= 14" 
 ]
Boland answered 23/8, 2023 at 5:8 Comment(0)
B
0

I had a similar problem but had a strange solution. My site was live with some errors which I completely ignored and created its build file and uploaded it on Netlify. So, what I was seeing was that it was live on localhost but had a blank page on Netlify. I spent hours resolving the issue, but none seemed to work. The next day, when I started the server to again look into the issue, I found that I had a blank page on localhost too. Later I realised that previously it was working because of continuous changes that I later added which had errors, but when freshly started again, it was not working.

So, all in all, before creating a build and pushing it on Netlify, always terminate and open the server again to make sure there is no problem with the code logic that you have created.

This seemed to work for me, so just sharing it in case it helps you.

Barrel answered 29/8, 2023 at 7:29 Comment(0)
G
0

When you're deploying a React app (created with npx create-react-app <name>) on Netlify, it is not necessary to change any command, directory, .... Just leave it, and deploy.

Geochronology answered 26/3, 2024 at 14:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.