Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: getaddrinfo ENOTFOUND localhost #2227

Closed
utnas opened this issue Sep 19, 2016 · 10 comments
Closed

Error: getaddrinfo ENOTFOUND localhost #2227

utnas opened this issue Sep 19, 2016 · 10 comments

Comments

@utnas
Copy link

utnas commented Sep 19, 2016

  1. OS? -> Mac OSX os: darwin x64
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
    => angular-cli: 1.0.0-beta.14
    => node: 6.6.0
  3. Repro steps:
    do on your code? etc.
    => Given: Install angular-cli: 1.0.0-beta.14
    When: Run "ng new my-project"
    And: I run "ng s"
    Then Get Error "getaddrinfo ENOTFOUND localhost"
  4. The log given by the failure:
    => getaddrinfo ENOTFOUND localhost
    Error: getaddrinfo ENOTFOUND localhost
    at errnoException (dns.js:28:10)
    at GetAddrInfoReqWrap.onlookup as oncomplete
  5. ..

@filipesilva
Copy link
Contributor

These two links seem to indicate that there is some problem with your localhost address:

http://stackoverflow.com/questions/35757799/webpack-dev-server-cant-find-localhost
webpack/webpack-dev-server#420

You can also see this section of the readme for a way to serve on a different address via the --host option:
https://github.com/angular/angular-cli#generating-and-serving-an-angular2-project-via-a-development-server

@nebiljabari
Copy link

nebiljabari commented Mar 12, 2017

All started with the same error (+ Firefox redirection from http://localhost to www.localhost.com) and 4h later..."still stuck"!

Long story short, it appears Ive accidently "corrupted" the /etc/hosts file when, for the anecdote, yesterday I set a new alias (who didn't worked) for my RaspberryPi IP >> without sudo <<

When Ive cat /etc/hosts the cat output was one messy line.
So I : cd /etc, sudo rm hosts, sudo nano hosts then paste and save the standard lines

@engineer-nadeem
Copy link

I am getting below error while trying to run my angular application.....what to do to fix it?

getaddrinfo ENOTFOUND localhost
Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)

@AmineAssali
Copy link

@nebiljabari thanks that's work for me

@ryanbeymer
Copy link

I can confirm adding the standard lines back for the definition of localhost on the hosts file did it form me.

##
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0     localhost

@SteveStanbury
Copy link

It worked perfectly, Thanks :)

@abhinavprakash
Copy link

Worked like a charm! Had changed the hosts file while setting up a hadoop cluster and never reverted to the original. Thank you 👍

@ManokarG
Copy link

Worked guys awesome community!!! 👍 💯

@HuangHongRui
Copy link

Thanks :)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants