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
3. save file and it should all work
You can do all of it with only one line
sudo echo "127.0.0.1 localhost" >> /etc/host
If you get error
permission denied: /etc/host simply enter in the terminal
sudo chown <username> /etc/host
Top comments (3)
Oh no that's a terrible idea ! This file must be owned by root to keep you away from security issues.
You can simply add this line to your /etc/host file:
And finally I googled it to see find it here, thanks though