Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change angular port from 4200 to any other

I want to use 5000 instead of 4200.

I have tried to create a file on root name ember-cli and put JSON according to the code below:

{    "port": 5000 } 

But my app still runs on 4200 instead of 5000

like image 848
Ashutosh Jha Avatar asked Nov 21 '16 10:11

Ashutosh Jha


People also ask

What is the command to change the default port of angular?

Port 4200 is the default port chosen by Angular CLI. You can change port via Angular CLI command and angular. json file.

How do I close port 4200 on Windows?

If you want to quit ng serve , you should use Ctrl+C instead, in which will also release the 4200 port.


1 Answers

The solution worked for me was

ng serve --port 4401     

(You can change 4401 to whatever number you want)

Then launch browser -> http://localhost:4401/

Basically, I was having two Applications and with the help of the above approach now I am able to run both of them simultaneously in my development environment.

like image 64
David Avatar answered Sep 30 '22 13:09

David