Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm fails to install on IPv6 only networks #348

Closed
darcyclarke opened this issue Nov 8, 2019 · 7 comments
Closed

npm fails to install on IPv6 only networks #348

darcyclarke opened this issue Nov 8, 2019 · 7 comments
Labels
Bug thing that needs fixing

Comments

@darcyclarke
Copy link
Contributor

  Original bug ticket: [https://npm.community/t/9508](https://npm.community/t/9508)
  Originally filed: 2019-08-16T14:43:42.575Z
@darcyclarke darcyclarke added Bug Bug thing that needs fixing and removed Community labels Nov 8, 2019
@VojtechMyslivec
Copy link

Hi, is this issue still valid? I see something similar was fixed in #35, but I encounter the same problem on IPv6-only server with DNS64 transition mechanism enabled.

npm install log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'build/staging_dir/hostpkg/bin/node',
1 verbose cli   'build/staging_dir/hostpkg/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'build/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/node-uglify-js-3.7.6'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.4
4 verbose npm-session 6c9e404bb1d51452
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly pacote directory manifest for undefined@file:build/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/node-uglify-js-3.7.6 fetched in 11ms
8 timing stage:loadCurrentTree Completed in 21ms
9 silly install loadIdealTree
10 silly install cloneCurrentTreeToIdealTree
11 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
12 silly install loadShrinkwrap
13 timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms
14 silly install loadAllDepsIntoIdealTree
15 silly resolveWithNewModule uglify-js@3.7.6 checking installable status
16 silly fetchPackageMetaData error for commander@~2.20.3 request to https://registry.npmjs.org/commander failed, reason: connect ENETUNREACH 104.16.22.35:443 - Local (0.0.0.0:0)
17 silly fetchPackageMetaData error for source-map@~0.6.1 request to https://registry.npmjs.org/source-map failed, reason: connect ENETUNREACH 104.16.19.35:443 - Local (0.0.0.0:0)
18 timing stage:rollbackFailedOptional Completed in 1ms
19 timing stage:runTopLevelLifecycles Completed in 81ms
20 verbose type system
21 verbose stack FetchError: request to https://registry.npmjs.org/commander failed, reason: connect ENETUNREACH 104.16.22.35:443 - Local (0.0.0.0:0)
21 verbose stack     at ClientRequest.<anonymous> (build/staging_dir/hostpkg/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
21 verbose stack     at ClientRequest.emit (events.js:315:20)
21 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:426:9)
21 verbose stack     at TLSSocket.emit (events.js:315:20)
21 verbose stack     at emitErrorNT (internal/streams/destroy.js:92:8)
21 verbose stack     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
21 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:84:21)
22 verbose cwd build/feeds/node/node-uglify-js
23 verbose Linux 4.4.0-189-generic
24 verbose argv "build/staging_dir/hostpkg/bin/node" "build/staging_dir/hostpkg/bin/npm" "install" "-g" "build/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/node-uglify-js-3.7.6"
25 verbose node v12.18.4
26 verbose npm  v6.14.6
27 error code ENETUNREACH
28 error errno ENETUNREACH
29 error request to https://registry.npmjs.org/commander failed, reason: connect ENETUNREACH 104.16.22.35:443 - Local (0.0.0.0:0)
30 verbose exit [ 1, true ]

If I use curl on the same server, it works as expected:

$ curl -I https://registry.npmjs.org/commander
HTTP/2 200 
date: Fri, 02 Oct 2020 22:00:25 GMT
content-type: application/json
content-length: 425372
server: cloudflare
...

Is it possible there is some hard-coded IPv4 method in npm install?

@NeverBehave
Copy link

NeverBehave commented Dec 24, 2020

It seems that npm still failed under ipv6 only network. The DNS resolves IPv6 + IPv4 addresses correctly at the same environment but npm or some components used by npm choose IPv4 somehow.

Output

17 silly fetchPackageMetaData error for dotenv@^8.2.0 request to https://registry.npmjs.org/dotenv failed, reason: connect ENETUNREACH 104.16.22.35:443 - Local (0.0.0.0:0)
18 silly fetchPackageMetaData error for telegraf@^3.25.0 request to https://registry.npmjs.org/telegraf failed, reason: connect ENETUNREACH 104.16.17.35:443 - Local (0.0.0.0:0)
19 silly fetchPackageMetaData error for telegraf-ratelimit@^2.0.0 request to https://registry.npmjs.org/telegraf-ratelimit failed, reason: connect ENETUNREACH 104.16.19.35:443 - Local (0.0.0.0:0)
20 silly fetchPackageMetaData error for dotenv@^8.2.0 request to https://registry.npmjs.org/dotenv failed, reason: connect ENETUNREACH 104.16.27.35:443 - Local (0.0.0.0:0)
21 silly fetchPackageMetaData error for telegraf@^3.25.0 request to https://registry.npmjs.org/telegraf failed, reason: connect ENETUNREACH 104.16.21.35:443 - Local (0.0.0.0:0)
22 silly fetchPackageMetaData error for telegraf-ratelimit@^2.0.0 request to https://registry.npmjs.org/telegraf-ratelimit failed, reason: connect ENETUNREACH 104.16.26.35:443 - Local (0.0.0.0:0)

Verbose

27 verbose stack FetchError: request to https://registry.npmjs.org/dotenv failed, reason: connect ENETUNREACH 104.16.27.35:443 - Local (0.0.0.0:0)
27 verbose stack     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
27 verbose stack     at ClientRequest.emit (events.js:315:20)
27 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:469:9)
27 verbose stack     at TLSSocket.emit (events.js:315:20)
27 verbose stack     at emitErrorNT (internal/streams/destroy.js:106:8)
27 verbose stack     at emitErrorCloseNT (internal/streams/destroy.js:74:3)
27 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)

Version & DNS

/ # npm --version
6.14.9
/ # nslookup registry.npmjs.org

Name:      registry.npmjs.org
Address 1: 2606:4700::6810:1023
Address 2: 2606:4700::6810:1523
Address 3: 2606:4700::6810:1823
Address 4: 2606:4700::6810:1b23
Address 5: 2606:4700::6810:1423
Address 6: 2606:4700::6810:1723
Address 7: 2606:4700::6810:1623
Address 8: 2606:4700::6810:1123
Address 9: 2606:4700::6810:1223
Address 10: 2606:4700::6810:1a23
Address 11: 2606:4700::6810:1323
Address 12: 2606:4700::6810:1923
Address 13: 104.16.19.35
Address 14: 104.16.17.35
Address 15: 104.16.25.35
Address 16: 104.16.18.35
Address 17: 104.16.16.35
Address 18: 104.16.26.35
Address 19: 104.16.24.35
Address 20: 104.16.21.35
Address 21: 104.16.22.35
Address 22: 104.16.23.35
Address 23: 104.16.27.35
Address 24: 104.16.20.35

Env

Docker Image:

node:lts-alpine3.10

@NeverBehave
Copy link

NeverBehave commented Dec 24, 2020

After dig into this issue deeper it seems like a nodejs behavior: nodejs/node#31567

For now, my work around will be adding some line to /etc/hosts hard-coded some ipv6 entries for npm to fetch stuff, as stated in the archived forum

@NeverBehave
Copy link

NeverBehave commented Dec 25, 2020

Dive even deeper I found this issue seems to happen only on alpine based image, node:current-buster seems fine.
It looks like something related to musl DNS resolver

@telmich
Copy link

telmich commented Jan 25, 2021

This might be related to #2519 and/or the same problem

@telmich
Copy link

telmich commented Jan 25, 2021

@darcyclarke is it possible to discuss this issue somewhere (matrix, slack, discord, irc)?

@darcyclarke
Copy link
Contributor Author

Closing as this looks like a Node.js issue & there's a fixed queued up. Please let me know if I'm wrong & I can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing
Projects
None yet
Development

No branches or pull requests

4 participants