欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

VUE Error: getaddrinfo ENOTFOUND localhost

程序员文章站 2022-07-06 12:08:03
本文介绍了vue error: getaddrinfo enotfound localhost,分享给大家。具体如下: jins-mbp:helloworld xxx...

本文介绍了vue error: getaddrinfo enotfound localhost,分享给大家。具体如下:

jins-mbp:helloworld xxx$ npm run dev

> dev /users/xxx/documents/develop/front/helloworld
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

 10% building modules 2/4 modules 2 active .../develop/front/helloworld/src/main.jsevents.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! dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm err! exit status 1
npm err!
npm err! failed at the 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/xxx/.npm/_logs/2018-04-18t01_01_10_246z-debug.log

根据报错内容,推断是localhost的问题。有可能是localhost没有绑定127.0.0.1。

修改方法:

添加host配置

127.0.0.1 localhost

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。