Open your cmd.exe
as administrator
,
then Find the PID
of port 4200
netstat -ano | findstr :4200
Here i have 3 PID :
LISTENING
kill only port 4200 (kill the red PID):
taskkill /PID 15940 /F
note : kill the green one will only lead your browser closed by force.
now you can do "ng-serve" to start your angular app at the same port 4200
Additional Stuff :
One liner : After looking a way to optimize this, Here is the One-liner command of this answer : (special thanks to : Josep Alsina for this tips)
for /f "tokens=5" %a in ('netstat -ano ^| find "4200" ^| find "LISTENING"') do taskkill /f /pid %a