webpack-dev-server can't find localhost

Solved, turned out my hosts file (found under /etc/hosts on a mac) had one line missing and so webpack couldn't find localhost. I restored it to its default following these instructions and it now works!


Make sure your /etc/hosts file includes localhost.

Open /etc/hosts

$ sudo vi /etc/hosts

Copy and paste this, if it's missing:

127.0.0.1   localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost

The most common reason for that error is that you have something else already using that port. Try starting it on another port.

webpack-dev-server --port 3001