Reputation: 2403
I have a trouble with npm, when I'm connected in my net it works nicely, but then I disconnected the computer, it stop working. When I run any command npm related, it fails giving me this error. Does anyone knows what's going on in there?
I have a Mackbook pro with Capitan OS
webpack-dev-server --config ./webpack/webpack.config.js --content-base ./app/ --watch --hot --inline --progress
70% 4/4 build modulesevents.js:141
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:26:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: `webpack-dev-server --config ./webpack/webpack.config.js --content-base ./app/ --watch --hot --inline --progress`
npm ERR! Exit status 1
Thanks in advance.
Upvotes: 1
Views: 985
Reputation: 2403
This is the key to find the solution:
Error: getaddrinfo ENOTFOUND localhost
I went to my /etc/hosts file and I notice that localhost was not there anymore.
Add this line:
localhost 127.0.0.1
Everything is fine now.
Upvotes: 4