Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

npm 2.5 and 2.6 fails with getaddrinfo EAI_FAIL when only loopback IP available #7508

@msimerson

Description

@msimerson
# uname -a
FreeBSD smtp 10.1-RELEASE-p6 FreeBSD 10.1-RELEASE-p6 #0: Tue Feb 24 19:00:21 UTC 2015     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

[root@smtp ~]# ifconfig   
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
    ether 00:0c:29:09:12:e8
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
    inet 127.0.0.9 netmask 0xffffffff 

# npm install -g ws
npm ERR! FreeBSD 10.1-RELEASE-p6
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "ws"
npm ERR! node v0.12.0
npm ERR! npm  v2.6.0
npm ERR! code EAI_FAIL
npm ERR! errno EAI_FAIL
npm ERR! syscall getaddrinfo

npm ERR! getaddrinfo EAI_FAIL
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /root/npm-debug.log
[root@smtp ~]# cat npm-debug.log 
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install', '-g', 'ws' ]
2 info using npm@2.6.0
3 info using node@v0.12.0
4 silly cache add args [ 'ws', null ]
5 verbose cache add spec ws
6 silly cache add parsed spec { raw: 'ws',
6 silly cache add   scope: null,
6 silly cache add   name: 'ws',
6 silly cache add   rawSpec: '',
6 silly cache add   spec: '*',
6 silly cache add   type: 'range' }
7 verbose addNamed ws@*
8 silly addNamed semver.valid null
9 silly addNamed semver.validRange *
10 silly addNameRange { name: 'ws', range: '*', hasData: false }
11 silly mapToRegistry name ws
12 silly mapToRegistry using default registry
13 silly mapToRegistry registry https://registry.npmjs.org/
14 silly mapToRegistry uri https://registry.npmjs.org/ws
15 verbose addNameRange registry:https://registry.npmjs.org/ws not in flight; fetching
16 verbose request uri https://registry.npmjs.org/ws
17 verbose request no auth needed
18 info attempt registry request try #1 at 14:34:44
19 verbose request id ec4a2d4d11e53a85
20 http request GET https://registry.npmjs.org/ws
21 info retry will retry, error on last attempt: Error: getaddrinfo EAI_FAIL
22 info attempt registry request try #2 at 14:34:54
23 http request GET https://registry.npmjs.org/ws
24 info retry will retry, error on last attempt: Error: getaddrinfo EAI_FAIL
25 info attempt registry request try #3 at 14:35:54
26 http request GET https://registry.npmjs.org/ws
27 verbose stack Error: getaddrinfo EAI_FAIL
27 verbose stack     at Object.exports._errnoException (util.js:746:11)
27 verbose stack     at errnoException (dns.js:49:15)
27 verbose stack     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26)
28 verbose cwd /root
29 error FreeBSD 10.1-RELEASE-p6
30 error argv "node" "/usr/local/bin/npm" "install" "-g" "ws"
31 error node v0.12.0
32 error npm  v2.6.0
33 error code EAI_FAIL
34 error errno EAI_FAIL
35 error syscall getaddrinfo
36 error getaddrinfo EAI_FAIL
37 error If you need help, you may report this error at:
37 error     <http://github.com/npm/npm/issues>
38 verbose exit [ 1, true ]

[root@smtp ~]# cat /etc/resolv.conf
nameserver 127.0.0.3

[root@smtp ~]# host registry.npmjs.org
registry.npmjs.org is an alias for a.sni.fastly.net.
a.sni.fastly.net has address 23.235.47.162

[root@smtp ~]# curl -O https://registry.npmjs.org/ws
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 70682  100 70682    0     0  67821      0  0:00:01  0:00:01 --:--:-- 67833

I've tried installing iojs 1.2 instead but get the same error when trying to do a npm install.

Having only a single loopback address is because this FreeBSD instance is actually a FreeBSD jail running under VMWare on my Mac. The jail host is running PF with NAT and provides each of the jails with networking:

nat on em0 from 127.0.0.0/8 to any -> (em0)

This failure is something new in the way node is now handling DNS, as this was working just fine with node 0.10 and below. As I showed with host and curl above, DNS and networking are obviously working. In fact, they work just fine for all these other apps:

root@freebsd10:~ # jls
   JID  IP Address      Hostname                      Path
     1  127.0.0.4       mysql                         /jails/mysql
     3  127.0.0.5       clamav                        /jails/clamav
     6  127.0.0.12      haproxy                       /jails/haproxy
     8  127.0.0.6       spamassassin                  /jails/spamassassin
     9  127.0.0.3       dns                           /jails/dns
    10  127.0.0.7       dspam                         /jails/dspam
    11  127.0.0.10      webmail                       /jails/webmail
    17  127.0.0.9       smtp                          /jails/smtp

Here's some tcpdump output with more interesting info.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions