Angular Ng Serve Is Not Hosting Site On Localhost
When I run ng serve on my CLI, I get the following output: Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ But when I
Solution 1:
To debug the issue try the following :
- ng serve -o
- Check the default port mentioned in config file with the key baseURL
- check with ng build command (if webpack is getting generated)
- ng serve --port 8080 --host 0.0.0.0 --disableHostCheck true
if possible try to upload browser console image
Solution 2:
First, verify your machine IP Address.
On Windows, type ipconfig
in Prompt (copy IPv4). On Mac, type ifconfig |grep inet
in Terminal (copy inet).
In my case, this is 192.168.0.10. Next, type the command ng serve --host 192.168.0.10
Ok, your app on air for all devices on the same network.
Now only http://192.168.0.10:4200/
will work, localhost not more.
Solution 3:
Consider these things :
- By opening server via
ng serve
, it can only be opened on browsers on that device. - If you want to serve it for the devices on your network you should use
ng serve -- host <your_device_ip>
Note: Device IP is the IP Address of the device you are serving from.
Post a Comment for "Angular Ng Serve Is Not Hosting Site On Localhost"