Thursday, July 5, 2018

“Port 4200 is already in use” when running the ng serve command

Windows 

  1. Command Window(cmd) - for /f "tokens=5" %a in ('netstat -ano ^| find "4200" ^| find "LISTENING"') do taskkill /f /pid %a
  2. GitBash - netstat -ano | findstr :4200; taskkill -PID -F

Mac OS X & Ubuntu

  1. sudo lsof -t -i tcp:4200 | xargs kill -9