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

后端 未结 30 1547
深忆病人
深忆病人 2020-12-02 03:47

I am learning angular 2 and for the first time I am using the angular CLI project to create a sandbox project.

I was able to run the command \"ng serve\" and it wor

30条回答
  •  余生分开走
    2020-12-02 04:20

    In summary there are more than one solution : 1 ) By using another port to define port number ,

    ng serve --open --port 4201
    

    2) by killing the process

    ctrl + c // for kill
    Close all node terminal which is related for running the app.
    

    3) Type

    netstat -a -n -o

    in command prompt then find the related port PID and kill it by

    taskkill /F /PID (pid number)

    4) Type netstat -ano|findstr :4200

    took the foreign address PID which contain the port number and then kill it by

    taskkill /PID (pid number)/F

提交回复
热议问题