How to kill Nodejs Port

How to Kill a Node.js Port

To kill a Node.js port, you can follow these steps:

  1. Find the Process ID (PID) of the Node.js Process:
  2. Use the following command to find the PID of the process running on a specific port: lsof -i :<port_number>
  3. Replace <port_number> with the actual port number. This command will display the PID of the process using the specified port.

  4. Kill the Process Using the PID:

  5. Once you have the PID, use the following command to kill the process: kill -9 <PID>
  6. Replace <PID> with the actual process ID obtained from the previous step. This command will forcefully terminate the process associated with the specified PID.

By following these steps, you can effectively kill a Node.js port.