MervCodes

Tech Reviews From A Programmer

Killing nodemon process in mac?

1 min read

Nodemon is a Node.js developer tool that helps to watch for file changes and restarting the node application automatically. It's an essential tool for any Node.js developer, but sometimes the process gets stuck and refuses to stop even after pressing Ctrl+C.

The Problem

You've stopped your nodemon process, but when you try to start it again, you get an error saying the port is already in use:

Error: listen EADDRINUSE: address already in use :::3000

This means the previous nodemon process is still running in the background.

The Solution

Open your terminal and run:

killall -9 node

This will kill all running Node.js processes on your Mac. If you want to be more targeted and only kill a specific process, first find the process ID:

lsof -i :3000

Then kill that specific process:

kill -9 <PID>

Replace <PID> with the actual process ID from the lsof output. This is the cleaner approach when you have multiple Node.js applications running and only want to stop one of them.