How to kill a localhost:8080
I'm trying to kill a dev server setup via yarn on Windows. While I Ctrl+C'd the command prompt, when I went back to localhost:8080
it had not stopped. How can I kill the process?
You can track down the process running on port 8080 and kill it.
For macOS or Linux:
sudo lsof -iTCP:8080 -sTCP:LISTEN
You should get an output something like:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
yarn 12017 user 12u IPv6 1876683 0t0 TCP *:8080 (LISTEN)
Now that you have the process ID(PID), you can kill the process. First try:
kill 12017(whatever the PID is)
If that does nothing, try:
kill -9 12017
For Windows:
netstat -ano | findstr :8080 (the port number)
This should give you the process to kill. You can then run:
taskkill /F /PID 12017(or whatever the process ID is)
If you install ProcessExplorer from SystemInternals, then you can see the process tree.
In ProcessExplorer, click the target-sight button, and then click on the cmd prompt that you launched the webrowser from. ProcessExplorer will then jump to that cmd prompt in its list. If the process view is not already threaded by parent-child relation, then press Ctrl-T a few times until it is. You then should be able to see the webserver. Select it, and then right-click on it. Select "Kill Process Tree" to forcibly kill the webserver.
SystemInternals also has pskill
. You can use pskill -t "MyWebServer"
to kill all processes, and their children, than are called MyWebServer
.