先看下我的报错
username:backend-atop-oa fulwin$ npm run dev
> [email protected] dev /Users/fulwin/Documents/codes/backend-atop-oa
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
10% building modules 1/1 modules 0 activeevents.js:183
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/fulwin/.npm/_logs/2018-01-08T07_29_15_303Z-debug.log
我是先删除了node_modules,重新npm install 没用(重新安装依赖)
rm -rf node_modules/
rm package-lock.json
npm cache clean --force
npm install
最后发现报错是这个意思:意思是 没有找到指定localhost
Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26
解决方法:config=>index.js中把host改为127.0.0.1
然后再次试试 npm run dev