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...
Having the same problem but I have 3 fixes for this you can use any
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
directly kill the port with the following command.
fuser -n tcp -k 5000
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.