Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1347:8)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '::',
port: 5000
}
[nodemon] app crashed - waiting for file changes before starting...
Asked
Active
Viewed 5,886 times
2

Marco_CH
- 3,243
- 8
- 25

masrura uddin
- 21
- 1
- 2
-
Your port is already running, try killing task running in that port `pkill -9 node` will kill all node operations – sojin Jan 06 '22 at 16:15
-
2https://stackoverflow.com/questions/9346211/how-to-kill-a-process-on-a-port-on-ubuntu – sojin Jan 06 '22 at 16:15
-
Another program has created a server on port 5000. Turn off the other server or choose a different port to run this server on. – code Jan 06 '22 at 22:48
2 Answers
2
Having the same problem but I have 3 fixes for this you can use any
1. a permanent and long way:
i. Install the kill-port node package as a dev dependency:
npm install kill-port --save-dev
ii. Create a nodemon.json file in the root of your project containing:
{ "events": { "restart": "kill-port 5000", "crash": "kill-port 5000" }, "delay": "1500" }
iii. Then, in your package.json file, have something like this:
"scripts": { "start-dev": "nodemon app.js", }
iv. Then start your app in dev mode with:
npm run start-dev
2. Manually kill from the system(easy fix):
directly kill the port with the following command.
fuser -n tcp -k 5000
3. Restarting the system:
- restarting the project
- restarting the computer

Mizanur Rahman Sohan
- 31
- 1
- 7
0
For windows
netstat -ano | findstr : 5000
(output : TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 18264)
taskkill /PID 18264 /f
Mainly this error comes when we run our code on same port or port already busy, so we have to kill the process
For ubuntu
fuser -k 5000/tcp

General Grievance
- 4,555
- 31
- 31
- 45

vishal sharma
- 142
- 5