Skip to content
MtrXTools

getaddrinfo EAI_AGAIN registry.npmjs.org

npm couldn't resolve the registry hostname

Seen in npm, yarn, Docker builds, CI runners, WSL

The DNS lookup for the registry failed temporarily, so npm never got an address to connect to.

Common causes

  • DNS is not working inside the container or build environment (common in docker build and WSL).
  • The machine is offline, or a VPN changed DNS servers.
  • A corporate network only resolves external names through a proxy.

How to fix it

  1. Test DNS where npm runs: nslookup registry.npmjs.org (inside the container if building an image).
  2. For Docker, set working DNS servers in /etc/docker/daemon.json ("dns": ["1.1.1.1"]) and restart Docker.
  3. If you must use a proxy, configure npm's proxy and https-proxy settings.
Check the registry resolves

Got a different message? Paste it into the error explainer.

Related errors

All 31 Dev tools & SSH errors