skip to Main Content

I have a React app made using create-react-app. I’ve been running this app without any issues for a few months now but have recently ran into an issue with starting the app because it says the port is in use. Here is the error message: Something is already running on port 3000. I’m trying to run the app on a Windows 10 machine.

Everything I’ve tried so far is listed below:

  • Running netstat -an and checking the output. This shows nothing running on port 3000.
  • Running netstat -an | findstr "3000". This shows no output.
  • Running npx kill-port 3000. I still get the port in use error message after running this.
  • Changing port that the app is running on. It doesn’t matter which port I choose, it always says the port is in use.
  • Checking the Listening Ports list in Resource Monitor shows nothing listening on port 3000
  • Restarting my PC

The only thing that works is running the app in a Ubuntu 20.04 VM… which seems to indicate there’s something listening on port 3000 on my Windows machine. However, I’m not sure what else I can do to troubleshoot this issue. I’m looking for suggestions on what else I could try.

Edit

Here’s the contents of my hosts file C:WindowsSystem32driversetchosts:

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
# Added by Docker Desktop
192.168.2.115 host.docker.internal
192.168.2.115 gateway.docker.internal
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section

2

Answers


  1. Chosen as BEST ANSWER

    I resolved the issue by restarting the WinNAT service. I found the solution in the answers here: Error: listen EACCES: permission denied 0.0.0.0:3001

    These are the steps:

    1. Start Command Prompt or PowerShell as Administrator
    2. Stop WinNAT with this command: net stop winnat
    3. Start WinNAT again with this command: net start winnat

  2. You can change it like below and try again, I’m not sure try once:

    FYI, C:WindowsSystem32driversetchosts

    Change to,

    # localhost name resolution is handled within DNS itself.
        127.0.0.1       localhost
        ::1             localhost
    

    Instead of below this:

    127.0.0.1 kubernetes.docker.internal
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search