Vue-cli: Error: getaddrinfo ENOTFOUND x86_64-conda_cos6-linux-gnu

Created on 30 May 2019  ·  7Comments  ·  Source: vuejs/vue-cli

Version

3.8.2

Reproduction link

https://private-repository...........

Environment info

  System:
    OS: Linux 4.19 Manjaro Linux undefined
    CPU: (4) x64 Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz
  Binaries:
    Node: 11.15.0 - /usr/bin/node
    Yarn: Not Found
    npm: 6.9.0 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: 67.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0-beta.3 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0-beta.3 
    @vue/babel-preset-app:  3.6.0 
    @vue/babel-preset-jsx:  1.0.0-beta.3 
    @vue/babel-sugar-functional-vue:  1.0.0-beta.3 
    @vue/babel-sugar-inject-h:  1.0.0-beta.3 
    @vue/babel-sugar-v-model:  1.0.0-beta.3 
    @vue/babel-sugar-v-on:  1.0.0-beta.3 
    @vue/cli-overlay:  3.7.0 
    @vue/cli-plugin-babel: ^3.6.0 => 3.6.0 
    @vue/cli-plugin-eslint: ^3.6.0 => 3.6.0 
    @vue/cli-plugin-unit-mocha: ^3.6.0 => 3.6.0 
    @vue/cli-service: ^3.7.0 => 3.7.0 
    @vue/cli-shared-utils:  3.6.0 (3.7.0)
    @vue/component-compiler-utils:  2.6.0 
    @vue/eslint-config-prettier: ^4.0.1 => 4.0.1 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/test-utils: 1.0.0-beta.29 => 1.0.0-beta.29 
    @vue/web-component-wrapper:  1.2.0 
    eslint-plugin-vue: ^5.0.0 => 5.2.2 (4.7.1)
    vue: ^2.6.10 => 2.6.10 
    vue-cli-plugin-vuetify: ^0.5.0 => 0.5.0 
    vue-eslint-parser:  2.0.3 (5.0.0)
    vue-hot-reload-api:  2.3.3 
    vue-loader:  15.7.0 
    vue-router: ^3.0.3 => 3.0.6 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.5.21 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
    vuetify: ^1.5.5 => 1.5.12 
  npmGlobalPackages:
    @vue/cli: 3.8.2

Steps to reproduce

  1. Create a vue project
  2. Try to run it with npm run serve

What is expected?

To build and run the server

What is actually happening?

 INFO  Starting development server...
 10% building 2/2 modules 0 activeevents.js:170                              
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND x86_64-conda_cos6-linux-gnu
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:58:26)
Emitted 'error' event at:
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1443:12)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:58:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] serve 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!     /home/terabyte/.npm/_logs/2019-05-30T16_21_56_926Z-debug.log

Most helpful comment

Please check if you have a $HOST environment variable set. If so, delete or overwrite it and try again.

All 7 comments

Please check if you have a $HOST environment variable set. If so, delete or overwrite it and try again.

❯ printenv HOST
x86_64-conda_cos6-linux-gnu

its working now :heart:

It's also solved my problem as well. Amazing solution @sodatea.

For whom, on macOS, get the same error or with the Nodejs error code EADDRNOTAVAIL (see below the full error message), and you are certain your /etc/hosts set the localhost correctly.

In my case, using iterm2 with zsh,

$ print HOST

x86_64-apple-darwin13.4.0

Which clearly is not localhost.

By setting the $HOST to localhost or empty, i.e.

HOST=localhost

Then the vue serve works as expected,

App running at:
  - Local:   http://localhost:8080/
  - Network: http://localhost:8080/

I'm not sure if this problem is more likely encountered by iTerm user. I've inspected the .zshrc and found no sigh of assigning HOST variable. And the mac terminal's HOST variable has no value.

There are ofc. other solutions like in full app we would pass config directly to webpack, or modify the package.json scripts, i.e. "serve": "vue-cli-service serve --host localhost", which are less elegant.


On macos, when I simply run vue serve or `vue

╰─ vue serve
 INFO  Starting development server...
 10% building 2/2 modules 0 activeevents.js:177
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRNOTAVAIL: address not available 211.137.170.246:8080
    at Server.setupListenHandle [as _listen2] (net.js:1209:19)
    at listenInCluster (net.js:1274:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1413:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:65:10)
Emitted 'error' event at:
    at emitErrorNT (net.js:1253:8)
    at processTicksAndRejections (internal/process/task_queues.js:84:9) {
  code: 'EADDRNOTAVAIL',
  errno: 'EADDRNOTAVAIL',
  syscall: 'listen',
  address: '211.137.170.246',
  port: 8080
}

@zrfrank are you anaconda or any thing like it ?

amazing solution thx @sodatea

I don't know if this will help anyone but I had the same issue as @zfrank and the following steps seemed to have solved it. I hope maybe if anyone else has this problem it may be of use.

I had anaconda active, and simply deactivating it with conda deactivate did not work. I had to disable autostart on my Anaconda environment.

conda config --set auto_activate_base false

I then added in a vue.config.js file and added the following:

module.exports = {
    devServer: {
        host: '127.0.0.1',
        port: 8080,
        public: 'localhost:8080',
    }
}

and that seems to have fixed the issue for now.

Was this page helpful?
0 / 5 - 0 ratings