-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
It prints a network related error:
npm error code EAI_AGAIN
npm error syscall getaddrinfo
npm error errno EAI_AGAIN
npm error request to https://registry.npmjs.org/react-dom failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-08-15T13_42_32_900Z-debug-0.log
Expected Behavior
Any error that is not network-related (e.g. because there's no packages.json) or success.
Steps To Reproduce
npm link is documented to only create a symlink, but instead it downloads stuff.
This might be a huge issue globally, because npm commands are often called in CI, and it is usually assumed that by the time npm link is called CI has all the deps cached (otherwise every pipeline someone somewhere triggers would result in accessing nodejs servers without devopses knowing it).
So unfortunately, npm link exhibits undocumented behavior where if it doesn't find deps in the system, it goes out online and silently fetches stuff from the internet, which puts excess load on both the users of CI and the nodejs servers.
To reproduce (in terms of terminal commands):
$ mkdir -p /tmp/foo && cd /tmp/foo
$ echo 'FROM docker.io/library/fedora:41\nRUN dnf install -y npm sqlite3' > Dockerfile
$ podman build -f Dockerfile -t test
[…build output snipped…]
$ podman run --rm --net=none test npm link react-dom
npm error code EAI_AGAIN
npm error syscall getaddrinfo
npm error errno EAI_AGAIN
npm error request to https://registry.npmjs.org/react-dom failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-08-15T13_42_32_900Z-debug-0.logEnvironment
- npm: 11.5.2
- Node.js: v24.5.0
- OS Name: Archlinux
- System Model Name: Dell G15
- npm config:
; node bin location = /usr/bin/node
; node version = v24.5.0
; npm local prefix = /tmp/foo
; npm version = 11.5.2
; cwd = /tmp/foo
; HOME = /home/constantine
; Run `npm config ls -l` to show all defaults.