Reputation: 325
I am using nodemon with express.js on localserver with 8080 port.
nodemon keeps always crushing after any change I do in my files with this error:
events.js:292
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::8080
at Server.setupListenHandle [as _listen2] (net.js:1313:16)
at listenInCluster (net.js:1361:12)
at Server.listen (net.js:1447:7)
at Function.listen (/home/sergey/Dev/Web/projects/YelpCamp/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/home/sergey/Dev/Web/projects/YelpCamp/app.js:69:5)
at Module._compile (internal/modules/cjs/loader.js:1123:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:972:32)
at Function.Module._load (internal/modules/cjs/loader.js:872:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1340:8)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 8080
}
[nodemon] app crashed - waiting for file changes before starting...
I can fix it just by adding space or enter, but nodemon will crush again after another change I will make.
My app.js listener:
app.listen(process.env.PORT || 8080, process.env.ip, function(){
console.log('Server is running!');
});
Upvotes: 0
Views: 4020
Reputation: 139
If you running on linux you need to kill all process at 8080 (or any port you get stuck)
kill $(lsof -t -i:8080)
Then run your application again. I think you make some bug in your code so it's affect to you nodemon.
Upvotes: 1