Search code examples
node.jswindows32-bit

Error: getaddrinfo ENOTFOUND 127.0.0.1 - Windows 32 bits - Node v6.11.2


I'm launching a server with the following script (arranca_server.sh)

# Arranca servidor Node
export NODE_ENV=development-curso
export NODE_PORT=9001
export NODE_HOST=127.0.0.1
node server

And Node returns:

>     events.js:160
>           throw er; // Unhandled 'error' event
>           ^
>     
>     Error: getaddrinfo ENOTFOUND 127.0.0.1
>         at errnoException (dns.js:28:10)
>         at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)

Node version:

$ node -v
v6.11.2

S.O. Windows 7 32 bits


What have I tried?

  1. Differents NODE_HOST like: localhost, 0.0.0.0, 127.0.0.1, computer_name, empty, ::1, computer_ip and others...
  2. Differents NODE_PORT like: 9001, 12001, 30001, ...
  3. Adding 127.0.0.1 localhost in c:\windows\system32\drivers\etc\hosts

Any ideas?


Solution

  • SOLVED

    In my case I have solved it by changing my file arranca_server.sh

    # Arranca servidor Node
    export NODE_ENV=development-curso
    export NODE_PORT=9001
    export NODE_HOST=127.0.0.1
    node server
    

    by this other arranca_server.bat

    # Arranca servidor Node
    SET NODE_ENV=development-curso
    SET NODE_PORT=9001
    SET NODE_HOST=127.0.0.1
    node server