Nodemon is a Node.js developer tool that helps to watch for file changes and restarting the node application once a change is detected. At times, we will usually kill the node application by pressing Ctrl+C, but that doesn’t always kill the Nodemon process properly. Often, you will see the very familiar error of port currently in use message. So this guide aims to help you resolve that issue.
Solution 1: Kill nodemon with port number
kill -9 $(lsof -t -i:1337)
Replace “1337” with your node application’s port number.
Solution 2: Search for nodemon process and kill it via process ID
Search for process ID
ps -ef | grep node
Kill process by process ID
sudo kill -9 <PID>