Error: getaddrinfo ENOTFOUND '0' when trying to start nuxt dev server

Viewed 3262

I wanted to start a nuxt dev server with this script in my package.json (my goal is to access the page from my mobile phone to test it):

"dev:host": "nuxt --hostname '0' --port 8000"

I basically copied the line from the nuxt docs (https://nuxtjs.org/docs/2.x/features/configuration#edit-host-and-port), but I get this error when executing the script:

FATAL  getaddrinfo ENOTFOUND '0'
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26)

That's weird, because when I edit nuxt.config.js and add a server object with the same properties, it works (at least at my pc, i still can't access the page with my phone although its in the same network, but I guess that's a different problem). Has anyone stumbled across this dns.js error as well?

2 Answers

Replace '0' with 0.0.0.0 (no quotes). It works for me on Windows 11.

"dev:host": "nuxt --hostname 0.0.0.0 --port 80"

Not sure of the issue here since it's working totally fine on my side.

Maybe try with 0.0.0.0.

Also, what is your OS? It's maybe your @nuxt/cli version?

Here is my test repo: https://github.com/kissu/so-nuxt-vimeo

Maybe host one on github and share it to me, that way I may try and see if it's fine on my side or not (will help debugging if it's Nuxt or system related).

enter image description here

Related