Andrew Mok

Node.js error: getaddrinfo ENOTFOUND localhost

1 min read

The error getaddrinfo ENOTFOUND localhost is caused by Webpack cannot found localhost address.

To solve it, open the terminal:

  1. sudo nano /etc/hosts
  2. Add following into the hosts file and save it.

    127.0.0.1 localhost

References:

I'm Andrew Mok, a developer raised in Hong Kong.
I enjoy working on modern web develpoment, and everything related :)