Home > Mobile >  Port In Use code: 'EADDRINUSE', even after kill command
Port In Use code: 'EADDRINUSE', even after kill command

Time:03-24

I have been running several MERN activities, one after another, working through exercises, but at some point when I run npm run develop, even thought I hit the kill command (trash icon) on mac, it tells me that something is still running on the port (3001), node crashes and then it starts, however only data from an older activity is rendered in the browser.

Here is the error;

Emitted 'error' event on Server instance at: [0]
 at emitErrorNT (node:net:1361:8) [0]
 at processTicksAndRejections (node:internal/process/task_queues:83:21) { [0]
code: 'EADDRINUSE', [0]   errno: -48, [0]   syscall: 'listen', [0]   address: '::', [0]   port: 3001`

Has anyone else experienced this problem and been able to fix it? Thank you.

I tried using the kill command trash icon. I made sure that I had used control c before killing the terminal.

It seemed to kill fine, and the subsequent activity seed ran without issue, but when I ran npm run develop, I got the error above, then it started successfully, but with only an older activity code and data.

CodePudding user response:

In your CLI check which ports are running by typing lsof -i:[PORT].

Sub [PORT] with the port you are trying to run. If it's running grab the PID and use it in the below command:

kill -9[PID]

Hope that works!!

  • Related