ng serve --open reports port 4200 is already in use when it isn't
See original GitHub issueng serve --open incorrectly reports that port 4200 is in use, even when no browsers are open.
Versions
Angular CLI: 1.6.7
Node: 8.9.4
OS: win32 x64
Angular: 5.2.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cli: 1.6.7
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.7
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0
Repro steps
- ng new aatest1 -si
- cd aatest1
- npm install
- ng serve --open
Observed behavior
ps>ng serve --open
Port 4200 is already in use. Use '--port' to specify a different port.
Desired behavior
ng serve --open should work correctly
Mention any other details that might be useful (optional)
The above behavior did NOT occur with Angular-CLI 1.6.6 or earlier.
Work-around
specify --port 4216 (any value between 4200 and 4215 causes the above mentioned error)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:18 (1 by maintainers)
Top Results From Across the Web
"Port 4200 is already in use" when running the ng serve ...
In this case, you need to change the port number of angular application as mentioned below. You already ran ng serve and to...
Read more >Port 4200 Is Already In Use. Use '–Port' To Specify A Different ...
Port 4200 is already in use. Use --port to specify a different port error occures sometimes when we run our angular app using...
Read more >“Port 4200 is Already in Use” When Running the ng serve ...
As we know, the ng serve uses default port number 4200 to run the angular application. And our application URL will be http://localhost:4200....
Read more >Why is Angular's port 4200? - Quora
It's not really Angular's port — it's the default port chosen by Angular CLI. The number 4200 serves no particular purpose other than...
Read more >Angular Server Port 4200 is already in use ng serve command
In this video I will show you, "How to fix Angular Server Port 4200 is already in use "Commands:netstat -a -o -ntaskkill -F...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
fuser -n tcp -k 4200 ng serve
I have attached the output from netstat. I cannot find anything that is listening on ports 4200 through 4215, the ones that no longer work as of Angular-CLI 1.6.7.
It’s as if the parsing of the default port number’s last two digits (00) is messed up because specifying port 4216 or above seems to work.
If I specify port 4201, for example, I still get the same error (port 4201 is in use):
Only ports 4216 and above work for me. Example:
aatest.txt