Yarn trying to reach IPv4 directly on a pure IPv6 system
Do you want to request a feature or report a bug? Bug
What is the current behavior? Yarn is unable to reach the registry as it tries to connect to it's IPv4 address. There's no internet facing IPv4 interface on this computer and thus no way to directly reach it. The system operates via DNS64/NAT64 for the purpose that works fine for everything else but seems to be failing for yarn. Almost feels like yarn is trying to reach a hard coded ipv4 instead of going to the ipv6 that i can see in nslookup of registry.yarnpkg.com
If the current behavior is a bug, please provide the steps to reproduce. Simply ensure you have an IPv6 system and using DNS64/NAT64 to interoperate with IPv4 world.
What is the expected behavior? Yarn operates as normal as it does on regular IPv4 systems
Please mention your node.js, yarn and operating system version. Node.js: 10.5.0 Yarn: 1.9.0-20180621.1517 (Nightly downloaded from site) OS: Windows 10 1708 x64
Exact command run & output
C:\Users\[REDACTED]>yarn global add @vue/cli
yarn global v1.9.0-20180621.1517
[1/4] Resolving packages...
⠁ (node:14720) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
error An unexpected error occurred: "https://registry.yarnpkg.com/@vue%2fcli: connect ENETUNREACH 104.18.97.96:443".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\[REDACTED]\\AppData\\Local\\Yarn\\Data\\global\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
Trace from log
Trace:
Error: connect ENETUNREACH 104.18.96.96:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:14)
One workaround is adding
2606:4700::6810:1723 registry.yarnpkg.com
2606:4700::6810:1723 registry.npmjs.org
2606:4700::6810:ab63 yarnpkg.com
to /etc/hosts. You can get the ip6 with nslookup registry.yarnpkg.com. The idea is from another comment on github I can't find anymore.
wild that this is still an issue in 2025. I will try the workarounds.