You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

后端JS学习遇Live Server连接失败:dial tcp 127.0.0.1:5500: connect: connection refused

Troubleshooting Live Server "Connection Refused" on Port 5500

Hey there, let's break down why you might be hitting that dial tcp 127.0.0.1:5500: connect: connection refused error even when you've confirmed the port is listening. Here are actionable leads to fix this:

  • Double-check which process is using port 5500
    Just knowing the port is in use isn't enough—make sure it's actually Live Server holding that port. Run these commands to verify:

    • Windows: netstat -ano | findstr :5500 (note the PID, then cross-reference it in Task Manager to see the process name)
    • Mac/Linux: lsof -i :5500 or ss -tulpn | grep :5500
      If another app is hogging the port, close that process or tweak Live Server's settings to use a different port (look for Server: Port in VS Code's Live Server config).
  • Verify Live Server's host binding
    Sometimes Live Server gets configured to bind to a non-loopback IP (like your local network address) instead of 127.0.0.1. Open VS Code settings, search for Live Server: Host, and set it to 127.0.0.1 or localhost. If it was set to 0.0.0.0 before, local connections to 127.0.0.1 might still fail depending on your network setup.

  • Rule out firewall/security software blocks
    Even if the port is listening, your system firewall or third-party antivirus could be blocking local connections to Live Server. Try temporarily disabling your firewall (just for testing!)—if the error goes away, add VS Code or Live Server to your firewall's allowed applications list.

  • Reset Live Server or VS Code state
    Cached configs or minor glitches in VS Code can cause odd behavior. Try these steps:

    1. Fully restart VS Code (close it completely and reopen)
    2. Disable and re-enable the Live Server plugin
    3. If that doesn't work, uninstall and reinstall Live Server to reset its default settings
  • Check your hosts file for misconfigurations
    A messed-up hosts file can break the 127.0.0.1 loopback. Open your hosts file:

    • Windows: C:\Windows\System32\drivers\etc\hosts (edit as administrator)
    • Mac/Linux: /etc/hosts (edit with sudo)
      Ensure there's a line that reads 127.0.0.1 localhost—if it's missing or altered, add it back and save.

内容的提问来源于stack exchange,提问作者Arian Rahman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 08:12:07