I am trying to work on my nodejs and reactjs app at school but everytime I run the server, I get an error with localhost:PORT/net::ERR_CONNECTION_REFUSED

Is the wifi refusing the connection on localhost?

PS: The react side renders correctly


Solution 1:

If you're using WSL (linux on windows), restart its service LxssManager Servie (run services.msc) and try again.

Solution 2:

Try changing the url from localhost to 127.0.0.1 . If it works, then it means your environment is not resolving localhost to 127.0.0.1

Or Try with changing the PORT Number