Almost every NodeJS developer would be familiar with the error message
Error listen EADDRINUSE: address already in use. The message simply means that the application could not start because there is already a process using that port. Here is the easiest way I have found to stop a process running on your Mac that is using a specific port.
- Add a new file called
stopto this directory:
You can easily do this by typing:
2. Past the following script into the file:
3. Save the script and start using it
You can use the script by typing
stop 3000 in to your terminal from any directory, where
3000 is the port number that has a process on it that you want to kill.
The script should output
Killed process 12345 running on 3000 , where
12345 is the process id(PID).