Unlike a timeout, “refused” is an answer: your browser found the address, knocked, and something actively turned it away. Either nothing is listening there (the site or server is down), or a firewall, proxy, or security program in between is doing the refusing.
“localhost refused to connect” almost always means the dev server isn’t running, or it’s running on a different port than the one in the address. Start the server, read the exact URL it prints (for example http://localhost:5173), and use that — port included. If the port is taken by another process, see EADDRINUSE.
If one site refuses on every device and network for a day or more, the service itself has a problem or has closed. If every site refuses on one PC only, scan for malware — rogue proxies installed by adware produce exactly this symptom.
What’s the difference between ERR_CONNECTION_REFUSED and a timeout? Refused is an immediate “no” from the other end or a middlebox. A timeout means no answer at all arrived. They point at different causes, which is why the fixes differ.
Can my internet provider cause ERR_CONNECTION_REFUSED? Yes, if its proxy or filtering refuses the connection — the phone test (mobile data vs Wi-Fi) tells you whether it’s network-specific.