🌐Connection refused (localhost refused to connect)
localhost refused to connect. ERR_CONNECTION_REFUSED
No server is waiting at that address. Most of the time, the dev server isn't running or has stopped.
🤔 Why does it happen?
- The dev server (npm run dev) wasn't started, or it stopped because of an error
- The port number is different (it may have started on 3001 instead of 3000)
- You closed the terminal window, and the server stopped with it
🔧 Try this
- Run npm run dev again in the terminal
- Open the exact address shown in the terminal (for example, http://localhost:3001)
- If the server stops right after starting, read the red error message in the terminal
🤖 Ask your AI like this
When I go to localhost, I get 'refused to connect' (ERR_CONNECTION_REFUSED). Please walk me through how to start the dev server step by step, and if the server won't start, look at the terminal output below and find the cause. [Paste the terminal output here]
Replace the [ ] parts with your own situation, and paste the error with a few extra lines before and after it.
Related terms
Other errors in this group
- Page not found (404)
404 Not Found - Internal server error (500)
500 Internal Server Error - Authentication failed (401)
401 Unauthorized - No permission (403)
403 Forbidden - Too many requests (429)
429 Too Many Requests - CORS error (cross-site request blocked)
blocked by CORS policy - Couldn't send the request (Failed to fetch)
TypeError: Failed to fetch - Mixed content (http request on an https page)
Mixed Content - Request method not allowed (405)
405 Method Not Allowed - What you sent is too big (413)
413 Payload Too Large - The middle server got no answer (502)
502 Bad Gateway - Service temporarily unavailable (503)
503 Service Unavailable - Redirects loop forever (too many redirects)
ERR_TOO_MANY_REDIRECTS - Blocked by an ad blocker
net::ERR_BLOCKED_BY_CLIENT - An image or file won't load
Failed to load resource: 404 (Not Found)