The local server localhost:3000 has been unable to connect

1. Check for processes using port 3000:

  • On Windows, runnetstat -ano | findstr :3000
  • On Mac/Linux, runlsof -i :3000

This will list any processes currently using port 3000. You want to kill these processes to free up the port.

2. Check the firewall rules:

Make sure your firewall allows connections to localhost:3000. On MacOS and Windows, there is usually no need to change any settings. But some antivirus software may block the port.

3. Check your server configuration:

Double check that your server code is tatsächlich listening on port 3000. For example, in Node.js:

app.listen(3000)

or in Python:

app.run(port=3000)

4. Check your network:

  • If you are using a wireless network, try an ethernet cable to troubleshoot wireless issues
  • Try accessing localhost on another device connected to the same network
  • Disable any VPNs you may be using

5. Check proxy settings:

If you use a proxy, make sure localhost:3000 is excluded from the proxy.

6. Reboot your server and machine:

Sometimes a simple restart can fix odd issues. Worth a try!

7. As a last thought, reinstall your development tools:

If the problem persists, there may be something corrupt in your Node/Python installation. Reinstalling your dev tools can sometimes fix weird network issues.

If none of the above methods work, localhost:3000 still fails to connect

 

Go back to the terminal and check if you have modified the contents of the .asdf/installs/ruby/2.6.9/lib/ruby/2.6.0/socket.rb file :

If you modify it and restore it to the original content, then use the command bundle exec rails server to start the server, and then open it in the browser

おすすめ

転載: blog.csdn.net/Toml_/article/details/131697630