Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKevin McNamara
7,483 PointsGetting error when running nodemon server
I have been getting this error :
Error: listen EADDRINUSE :::3000 at Object.exports._errnoException (util.js:1008:11) at exports._exceptionWithHostPort (util.js:1031:20) at Server._listen2 (net.js:1253:14) at listen (net.js:1289:10) at Server.listen (net.js:1385:5) at EventEmitter.listen (/Users/kevinmcnamara/express-dill/dill-website/node_modules/express/lib/application.js:617:24) at Object.<anonymous> (/Users/kevinmcnamara/express-dill/dill-website/src/app.js:21:5) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32) [nodemon] app crashed - waiting for file changes before starting...
When i run nodemon src/app.js
When I try it with node src/app.js I get the same thing
I typed in the browser localhost:3000 and it is loading but never sends the response. Anyone know how to fix this?
1 Answer
David Choi
8,311 PointsYou can try the following commands:
killall -9 node
This command will kill the entire process
ps ax
And then you can check if it worked and try again
boas dun
Courses Plus Student 16,109 Pointsboas dun
Courses Plus Student 16,109 PointsHad this error: Error: listen EADDRINUSE :::5858 at Object.exports._errnoException (util.js:953:11) at exports._exceptionWithHostPort (util.js:976:20) at Agent.Server._listen2 (net.js:1253:14) at listen (net.js:1289:10) at Agent.Server.listen (net.js:1385:5) at Object.start (_debug_agent.js:21:9) at startup (node.js:86:44) at node.js:449:3
Fixed it by killing the process that was running on 5858 (googled a little bit)
First find what's running on (in my case) 5858, by typing:
ps aux | grep 5858
(Edit: A second time a got a wrong process id and the previous one didn't work, apparently:
sudo lsof -i :5858
also worked )
I got something like:
[username] 926 0.0 0.3 3694948 55760 ?? S 9:41PM 0:01.34 /usr/local/bin/node --debug-brk=5858 /Users/[username]/Desktop/THouse/express-basics/src/app.js
Apparently the first number is the PID (process ID), which i 'killed' (not sure if that's entirely safe though) with:
kill -9 926
After that
nodemon --debug src/app.js
worked without errors. Hope it works for you as well!