I have been working on several Node Express APIs and while they were working yesterday, I have rebooted my machines (laptop and workstation) and they are giving ENOTFOUND error for localhost (syscall getaddress info). I have thoroughly tested these APIs and I’m still getting:
error: Error: getaddrinfo ENOTFOUND locahost
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'locahost',
fatal: true
}
I am using Ubuntu (WSL) on both machines. I’ve checked /etc/hosts and 127.0.0.1 is localhost. I am lost as to what to do from here. I’m ready to test a third API and it’s giving the same error. I deleted rm -rf
node_modules and reinstalled. Still no go.
Any help is appreciated.
2
Answers
I found it. The ENV export for the MariaDB database "DB_HOST=locahost"
Hello I’m if there is a localhost connection issue you will try also like instead of
replace this IP with your localhost string and write into string 🙂
FYI check your port also, it will run on a particular port 🙂