Problem?
While working with node js project (npm or yarn) in the terminal, sometimes we face a strange problem.
Sometimes even if we close the server in terminal, still it is runing under the hood. When we restart the server
again (using npm start
or yarn start
), it ask for assigning new port.
- How to Run Php Projects in Xampp
- Limiteds vs a Really Toxic Server New Journey MNJ Roblox
- To Kill a Mockingbird Summary | By Harper Lee To Kill a Mockingbird Audiobook
- VPN Kill Switch Explained: Why You Need It for Ultimate Online Privacy! | VPN EXPO
- Build Your Own Pull-Out Pantry
- How to Connect to Remote SSH in VS Code and Transfer Files Over SFTP to VPS Server Full Tutorial
- How to SUPER JUMP in Roblox combat warriors ...
- How to Setup SFTP Server on Ubuntu 24.04 (Simple Guide)
- How to install docker on ubuntu AWS Server
- What Is Port Forwarding Gaming
- how to make a second unturned server
- Security; How should be set an unprotect environment on modern linux to test an old buffer overfl...
- How To Build Your Own Home in Don't Starve; Shipwrecked
- Organizing Kitchen Cabinets Efficiently
- How to draw Sauna Egg from Cookie Run Ovenbreak
- How to Clean the USB Port of OPPO A77s Phone using Simple Household Items
- What Is A Dedicated Server In Gaming
But we don't want to do that. Under the hood server is occupying that port and we want to use that port.
If you are using mac os, here is quick step to kill the server which is runing under the hood.
Steps to solve this problem
- Find the Process ID (PID)
First of all you will need to find the process ID on which that server is running on that specific port.
For example, if server was running at port 8000
, you can find the PID using this below command:
sudo lsof -ti :8000
Result:
89711
here, irdmi is basically represents port 8000.
- Kill Process ID (PID)
Use this command to kill the process.
kill -9 <PID>
e.g.:
kill -9 89711
That's all.
In single line, you can write command as below
kill -9 $(lsof -ti:<PortNumber>)
e.g.:
kill -9 $(lsof -ti:8000)