运行vue项目getaddrinfo ENOTFOUND localhost错误

时间:2017-09-22 17:29:08

标签: npm yarnpkg nuxt.js

我初始化了一个nuxt项目,当我尝试使用npm run dev或yarn dev命令运行它时,它会返回以下错误:

    build [==================  ] 91%Error: getaddrinfo ENOTFOUND localhost
    at errnoException (dns.js:50:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
error Command failed with exit code 1.

知道它来自哪里?

1 个答案:

答案 0 :(得分:7)

将127.0.0.1 localhost添加到/ etc / hosts