Tuesday, February 28, 2017

How to solve nodejs Error: listen EADDRINUSE?

In this post we are going to discuss about how to solve Node.js error: listen EADDRINUSE. EADDRINUSE actually means that the port number which you are binding to the server using listen() is already in use.

If any application is already running on 3000 then you will get the below error (Error: listen EADDRINUSE). Here is the screenshot of error:

To solve this error either you start your node server on another port or close the program using that port. If you use lsof, you can see what process is bound to the port with lsof -i:3000, and then force kill it by grabbing the process id (aka pid) and kill it with a kill -9 $pid.

You'll only see it if you have permissions; if you're running lsof as a different user than the app, try prefixing lsof -i:$port with sudo to make sure you have adequate permissions.

Ref: https://teamtreehouse.com/community/hi-its-throwing-an-error-listen-eaddrinuse-3000-unhandled-error-event

No comments:

Post a Comment