Firefox can’t establish a connection to the server at localhost:3000 when trying to deploy react app with Netlify

39 views Asked by At

I'm trying to deploy a React app on Netlify. I've successfully created the project on Netlify, and the logs seem to be successful, all of them. When I go to the url, Firefox can't connect: Firefox can’t establish a connection to the server at localhost:3000. I've followed the documentation on Netlify about the deployment of a React App very carefully.

I'm also getting the following error on the console: enter image description here

This is my first time deploying on Netlify.

I did try to deploy through the Netlify CLI which it too was successful, but again, when I'm trying to view the site, it shows the same connection failure.

1

There are 1 answers

1
fool On

Your site should not "end up with" URL's including localhost in the published source code, since that will refer a visitor to "their computer" and even referring them to "your computer" (rather than netlify) is presumably not your intention.

Netlify doesn't automatically embed URL's like those into your build, so presumably, somewhere in a config file or environment variable, you have things configured to use that URL, and that is influencing what is published, making it incorrect. You'll want to hunt down and remove or update that setting (presumably, to your custom domain or the sitename.netlify.app that corresponds to your site), though I don't have any good advice as to where it might be set incorrectly.

You could use a tool like grep -r localhost directory (where directory is your to-be-published, already-built-locally copy of the build), to see if you can tell where it is ending up, and maybe work backwards from there to figure out where it is getting set and removing it. Using the same check after repairing should turn up no hits :)