simbro
simbro

Reputation: 3672

Angular CLI - ng serve won't run unless I specify port

I have an application generated with Angular CLI running on a Ubuntu box. When I run:

ng serve

From the project's root directory, everything works, except that I can't load the load the application in my browser when I navigated to:

http://host.domain.tld:4200/

However, when I run:

ng serve --host 0.0.0.0 --port 4201 --live-reload-port 49153

Then I the application loads in my browser.

How can I configure the application to be accessible on the dev server by just running "ng serve"?

Upvotes: 2

Views: 2286

Answers (2)

SirGanya
SirGanya

Reputation: 141

The dev server prevents connections from outside as a security precaution. If you wish to run the dev server without it being blocked run

ng serve --host 0.0.0.0 --disable-host-check

Upvotes: 4

Mostafa Fateen
Mostafa Fateen

Reputation: 847

you can go edit your package.json file and change this line:
"start": "ng serve",
with
"start": "ng serve --host 0.0.0.0 --port 4201 --live-reload-port 49153",
and then you could just simply run npm start

Upvotes: 1

Related Questions