Port 4200 is already in use. Use ‘-port’ to specify a different port error Reasons
An existing application(not angular) in your system using the port number 4200. This is a very rare scenario. In this case, you need to change the port number of angular application as mentioned below.
You already ran ng serve and to exit the application you typed Control Z (Ctrl+Z), And then you typed ng serve then you will get port 4200 is already in use_ error. In this case, you need to kill the previous process
To close or terminate the angular instance always use Control+C (Ctrl+c)
And ng serve uses default port number 4200 to run the angular application. And our application URL will be http://localhost:4200. To avoid this error we need to change the port number to other port which is free.
According to RFC 793 port numbers is a 16-bit unassigned integer. The minimum value is 0 and the maximum value is 65535.
And, within this range, ports 0 – 1023 are reserved for specific purposes(mostly).
To change the port number for our angular application use the below command
ng serve –port 4201
Now type ng serve
Our angular application will be running on http://localhost:4201
To kill already existing angular process use the below commands
Fix Port 4200 is already in use. Use ‘-port’ to specify a different port error in Mac & Linux
To fix port 4200 is already in use error in In Mac & Linux OS (Ubuntu etc) use the following commands
sudo kill $(sudo lsof -t -i:4200) Or
sudo lsof -t -i:4200 Or
sudo lsof -t -i tcp:4200 | xargs kill -9
Fix Port 4200 is already in use. Use ‘-port’ to specify a different port error in Window
In Window operating system open command prompt. Use the following command to fix port 4200 is already in use error.
netstat -a -n -o | findStr “4200”`
Take the process id and kill the process using the following command
taskkill -f /pid 11128
- Through PID (process identification) to find the port (port) occupied applications, to solve the problem of port occupied
- Solution to the problem that listen TCP 0.0.0.0:3306: bind: address already in use port is occupied in Linux centos7
- View port and resolve port conflict in Windows
- The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in u
- Eclipse port occupied（ java.net.BindException : address already in use: bind) solution
- Kafka opens JMX port and reports that the error port is occupied
- Centos Failed to Modify the port of SSH: error: Bind to port 27615 on 0.0.0.0 failed: Permission denied.
- Vs problem port in use
- Kill the specified port CMD command line taskkill in window
- Error running ‘Tomcat 8.5.31’: Unable to open debugger port
- Node.js Using port 80 to report errors in Linux
- The ADB server port is changed to 10001, and appium cannot connect to the device
- The Tomcat connector configured to listen on port 7014 failed to start
- Port out of range: – 1 for Tomcat startup in idea
- Explanation of port mapping in dlink
- filezilla Failed to create listen socket on port 21 for IPv4 solution
- Resourcemanger reported an error: the port is unavailable
- The error record when docker starts Nacos, and the solution to the problem of port occupation
- Android error: ADB port is occupied（ adb.exe ,start-server’ failed — run manually if necessary)
- socket.error : [errno 10048] and view PID process number and port number