Error: getaddrinfo ENOTFOUND localhost.localdomain

harken24 profile image Jozo ・1 min read

Today I went to work on a project for a company I'm working (it's a web app built in Vue.js). When I encountered an error I haven't seen before.
Error: getaddrinfo ENOTFOUND localhost.localdomain

So to save you all from googling I'll show you a simple step to solve this. The problem here is that app can't find localhost as host in the /etc/host. To solve this enter in your terminal:
1. sudo vim /etc/host (you can use any editor you want I just prefer vim)
2. inside /etc/host enter localhost
3. save file and it should all work

Pro tip:
You can do all of it with only one line sudo echo " localhost" >> /etc/host
If you get error permission denied: /etc/host simply enter in the terminal sudo chown <username> /etc/host

Posted on by:

harken24 profile



Web developer lurking around.


Editor guide

And finally I googled it to see find it here, thanks though


You're welcome.