npm "could not resolve host registry.npmjs.org" in CI - Fix DNS Failures
A could-not-resolve-host error means DNS could not turn the registry hostname into an address. It can be a transient DNS blip or a misconfigured registry URL or proxy.
What this error means
npm install fails with getaddrinfo ENOTFOUND or EAI_AGAIN for registry.npmjs.org or your private registry host. A transient blip clears on retry; a persistent failure points at config.
npm
npm ERR! code ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/react failed,
reason: getaddrinfo ENOTFOUND registry.npmjs.orgCommon causes
Transient DNS resolution failure
A momentary DNS outage on the runner fails to resolve the host and clears on retry.
A wrong registry URL or missing proxy
A typo in the registry hostname or a network that requires a proxy makes the name unresolvable persistently.
How to fix it
Verify the registry and DNS
- Print the configured registry and confirm the hostname is correct.
- Test DNS resolution from the runner.
Terminal
npm config get registry
getent hosts registry.npmjs.org || nslookup registry.npmjs.orgConfigure the proxy if required
- Set the HTTP/HTTPS proxy npm should use on a restricted network.
- Re-run the install.
Terminal
npm config set proxy http://proxy.internal:8080
npm config set https-proxy http://proxy.internal:8080How to prevent it
- Pin a correct registry URL, configure any required proxy in the runner image, and add fetch retries. Latchkey managed runners auto-retry transient DNS blips and cache the registry, so intermittent resolution failures usually self-clear.
Related guides
Node.js "getaddrinfo ENOTFOUND" - Fix DNS Failures Reaching the RegistryFix Node.js / npm "getaddrinfo ENOTFOUND registry.npmjs.org" in CI - a DNS resolution failure for the registr…
npm EAI_AGAIN "getaddrinfo EAI_AGAIN" - Fix Temporary DNS Failure in CIFix npm EAI_AGAIN "getaddrinfo EAI_AGAIN registry.npmjs.org" in CI - a temporary DNS failure, common inside D…
npm ETIMEDOUT Registry Request Failed in CI - Fix Network TimeoutsFix npm ETIMEDOUT and network-request-failed errors in CI with fetch retries, caching, and a mirror, since mo…