Got this error anytime? Well, this is the most common error we get while starting a node server or running a node application.
But do you know what does this error mean?
EADDRINUSE (address already in use) error occurs when the port number where you want to start your server is already in use by other server.
For example: if you are running a node application on port number 3000. And if you try to start another server on the same port number, you will get the error.
Another instance, where you have already started the node server for your application and try to run the same application without stopping the previous instance, you will receive EADDRINUSE error.
Now, coming back to the Solution to the error:
ps aux | grep node
use this command to identify the processes running with their process ids.
Once, you identify the process id, execute below command. In above output, 535650 is the process id where node is running.
kill -9 PID
where PID should be replaced with process id. So, kill -9 535650 will kill the node process and the port will be available to reuse.
Happy Coding!