Kill an anoying "invisible" process running in localhost πŸ”«πŸ˜’

wakeupmh

Marcos Henrique

Posted on October 30, 2019

Kill an anoying "invisible" process running in localhost πŸ”«πŸ˜’

I was working on a project in Vue running with yarn dev (dev-server), but gone out for a coffee β˜• when I returned to table my nootebook was bugged πŸ˜’, like every windows user, I did the magic shortcut πŸŽ‡ (crtl + alt + del) for the task manager and I restarted the crashed process (my hyper bash, if you don't know hyper see more here which was running my application, in my innocence I thought I could run yarn dev again

But it throw an error looks like that A process is already running on port 3000, finish it to run on this port I did the magic shortcut πŸ˜ͺ, and for my surprise, nothing running in task manager...

How I solve this anoying error? πŸ€”

Run command-line as an Administrator

netstat -ano | findstr :portnumber
Enter fullscreen mode Exit fullscreen mode

Now you will see something like that:

Pink coloured rectangle area shows the PID (process identifier)

Let's kill it 😎

Then you execute this command after identify the PID.

taskkill /PID yourPID /F
Enter fullscreen mode Exit fullscreen mode


(The /F option forcefully terminates the process)

Run the first command again to check if process is still available or not.
You'll get empty line if process is successfully ended.

The superb way 🀺

Run Windows PowerShell to stop a process on your wanted port, just type:

Stop-Process (,(netstat -ano | findstr :yourPort).split() | foreach {$[$.length-1]}) -Force
Enter fullscreen mode Exit fullscreen mode

OK, this saved my skin, but WTF is nestat?

Netstat β€” derived from the words network and statistics β€” is a program that’s controlled via commands issued in the command line. It delivers basic statistics on all network activities and informs users on which portsand addresses the corresponding connections (TCP, UDP) are running and which ports are open for tasks (if want know how this properly works, you can read more here)

Hope this helps if you come across this boring error πŸ€—

That's all, folks

πŸ’– πŸ’ͺ πŸ™… 🚩
wakeupmh
Marcos Henrique

Posted on October 30, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related