ExpressJS - throw er Unhandled error event ExpressJS - throw er Unhandled error event express express

ExpressJS - throw er Unhandled error event


You had run another server use the same port like 8080.

Maybe you had run node app in other shell, Please close it and run again.

You can check PORT no. is available or not using

netstat -tulnp | grep <port no>

Alternatively, you can use lsof:

lsof -i :<port no>


We do get similar error when we sometimes run our express app. We have to follow the same in that case. We need to check if its running in any terminal. If you want to find and kill process, follow these steps:

  • ps aux | grep node
  • Find the process ID (second from the left):
  • kill -9 PRCOCESS_ID

OR

Use a single command to close all the running node processes.

ps aux | awk '/node/{print $2}' | xargs kill -9


An instance is probably still running.This will fix it.

killall node

Update: This command will only work on Linux/Ubuntu & Mac.