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
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
Unless the process you're trying to kill is one that gets started upon booting the server, rebooting the computer in question would probably work. It's probably a last resort option due to losing everything else the computer's been doing that hasn't been saved, and the time it takes for the reboot to occur, but there's a reason why a lot of IT professionals start their troubleshooting process for user machines with "Have you tried turning the computer off and back on again?"