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 trialMichael Davis
17,071 Pointsgetting various Error: listen EADDRINUSE :::3000/5858
happy friday folks!
i have been beating my head against the wall trying to solve this while running nodemon and node-inspector.
i keep getting this error:
events.js:160 throw er; // Unhandled 'error' event ^
Error: listen EADDRINUSE :::3000 at Object.exports._errnoException (util.js:1012:11) at exports._exceptionWithHostPort (util.js:1035:20) at Server._listen2 (net.js:1252:14) at listen (net.js:1288:10) at Server.listen (net.js:1384:5) at EventEmitter.listen (/Users/michaeldavis/treehouse-express-basics/MyFirstExpressApp/node_modules/express/lib/application.js:617:24) at Object.<anonymous> (/Users/michaeldavis/treehouse-express-basics/MyFirstExpressApp/app.js:16:5) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32)
or i get it with the :::5858 rather than the :::3000 listed above.
i have tried all kinds of work arounds.
now i can't even run the app via basic node without getting this error, not to mention nodemon.
help????
4 Answers
Seth Kroger
56,413 PointsEADDRINUSE means there is already another running process that is listening to the port your node app wants to use and has it reserved. It's most likely you've run the app previously but it hasn't terminated properly and is still holding on to the port.
It can be fixed by looking for still-running node processes and ending them with the ps
and kill -9 PID
(where PID is the process number from ps
) commands on Linux/MacOS terminal or Task Manager on Windows.
Seth Kroger
56,413 Pointsps ux
should cover any node commands you've launched. ps aux
will show you all the processes going on your system.
Michael Davis
17,071 Pointsok awesome. sorry, what i hope is the last question, and thanks again for answering them... i get a table of various columns and rows of information when i run either of those commands. in the columns, which on gives the port number?
these are the titles of the various columns returned:
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
Seth Kroger
56,413 PointsThe column you want is the PID (Process ID) column. Look for the PID of any node command and kill them.
Michael Davis
17,071 Pointswell that definitely helped and got things on the right track when it comes to getting my node app up and running again.
unfortunately, now i am seeing this error:
Error: Cannot find module '/usr/local/lib/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.7.7/node-v48-darwin-x64/debug.node'
when i am trying to run nodemon and node-inspector...
- run node-inspector
- run nodemon in separate terminal window
- refresh node-inspector at http://127.0.0.1:8080/?port=5858 which produces the error above
any help out there?
thanks many times over in advance
Michael Davis
17,071 PointsMichael Davis
17,071 PointsThanks seth! I am using the terminal app on OS X El Capitan What command do you use to find that still running node processes?
Also, do you think the versions of node, nodemon, node-inspector impact this at all?