netstat -ano | findstr "PORT_NUMBER"
taskkill /PID <ID_HERE> /f
//can be found on the last column next to LISTENING
____________________________________________________________________________
TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 24660
____________________________________________________________________________
!!
taskkill /PID 24660 /f
//Open command prompt and run the following commands
C:Usersusername>netstat -o -n -a | findstr 0.0:3000
TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 3116
C:Usersusername>taskkill /F /PID 3116
//here 3116 is the process ID
netstat -ano | findstr :<PORT>
(Replace <PORT> with the port number you want, but keep the colon)
Step 2:
Next, run the following command:
taskkill /PID <PID> /F
// Option 1: if you have npm@5.2.0^ version
npx kill-port 8080
// Linux
kill -9 $(lsof -t -i tcp:8080)
// Windows command line:
for /f "tokens=5" %a in ('netstat -aon ^| find ":8080" ^| find "LISTENING"') do taskkill /f /pid %a
// Windows bat-file:
for /f "tokens=5" %%a in ('netstat -aon ^| find ":8080" ^| find "LISTENING"') do taskkill /f /pid %%a