Node.js error: getaddrinfo ENOTFOUND localhost

Node.js error: getaddrinfo ENOTFOUND localhost

Image for post

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:

  • ??node???getaddrinfo ENOTFOUND localhost??
18