Skip to content

Instantly share code, notes, and snippets.

@erikvullings
Created November 10, 2021 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikvullings/3d5dcdc09ce950f040852a31e519a732 to your computer and use it in GitHub Desktop.
Save erikvullings/3d5dcdc09ce950f040852a31e519a732 to your computer and use it in GitHub Desktop.
EADDRINUSE error

EADDRINUSE error (Endpoint Address In Use)

Error: listen EADDRINUSE: address already in use :::1234

When node.js complains that an address is in use, this may happen because the service did not end properly. In order to kill the hanging process, do the following in an Admin PowerShell window:

netstat -ano|findstr "PID :1234"
taskkill /pid 24480 /f

Explanation

Use the netstat command lists all the active ports. The -a switch displays all ports in use, not just the ports associated with the current user. The -n option stops a hostname lookup (which takes a long time). The -o option lists the process ID that is responsible for the port activity. The findstr command matches the header row that contains the PID string, and the port you are looking for, in a port format with the preceding colon, is :3000.

C:\Users\admin>netstat -ano|findstr "PID :3000" 
Proto Local Address Foreign Address State PID 
TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 18264

To kill this process (the /f is force):

taskkill /pid 18264 /f

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment