Reputation: 925
I want to open my angular app other than localhost for my development purpose but running into below error, any guidance on how to fix it?
username$ ng serve --open --host=ibaitdev.company.com
getaddrinfo ENOTFOUND ibatdev.company.com
Error: getaddrinfo ENOTFOUND ibatdev.company.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
I changed my /etc/hosts
as below
#
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 ibaitdev.company.com
255.255.255.255 broadcasthost
::1 ibaitdev.company.com
Upvotes: 6
Views: 5645
Reputation: 439
Using ng serve --host 0.0.0.0 --disable-host-check
will allow you to connect to the server using your IP 0.0.0.0 instead of localhost.
This will disable host check and allow to access from outside with IP address instead of localhost.
In newer versions of the AngularCLI (higher than v5), you can use 0.0.0.0 as the IP again to host it on your network.
Upvotes: 13
Reputation: 276
You can do ng serve --host=127.0.0.1 and then when you go to your browser just go to that domain name. (127.0.0.1:4200)
Upvotes: 5