Description
Version
$ node -v
v22.14.0
$ npm -v
10.9.2
Platform
Linux 5.14.0-503.19.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 19 12:55:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
I have a custom registry for my company set in .npmrc. This has been working for many years. I recently upgraded from nodejs v16 to nodejs v22 and I am facing sporadic failures with trying to "npm install" our internal registry.
After a lot of googling I see that in v17, the IP addresses to resolve the registry are now returned in a somewhat random order. It seems that my issue is when the IPv6 address is being used.
I have tried the setting --dns-result-order=ipv4first in many ways, i.e. running "node --dns-result-order=ipv4first npm install" and also "export NODE_OPTIONS=--dns-result-order=ipv4first" but neither seem to work.
Only completely disabling IPv6 in my Rocky Linux 9 machine allows me to install our internal npm modules.
Is the --dns-result-order=ipv4first setting being ignored?
When I do node -h I do not even see NODE_OPTIONS as one of the available environment variables either.
And yes, I have deleted the proxy config as per my googling of this issue but it didn't help:
npm config delete http-proxy
npm config delete https-proxy
npm config rm proxy
npm config rm https-proxy
export HTTP_PROXY=null
export HTTPS_PROXY=null
Please help!
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
No response
What do you see instead?
$ node --dns-result-order=ipv4first /usr/bin/npm install @xxx/YYYYY
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://my-custom-registry/ failed, reason:
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
Additional information
As mentioned above. Disabling IPv6 in my Rocky Linux 9 machine fixes the issue. But shouldn't the --dns-result-order=ipv4first essentially do the same without having to do a machine wide config change?