npm Registry Errors in CI: ECONNRESET, ETIMEDOUT, and 5xx
npm install pulls from a shared registry over the network. Transient resets, timeouts, and 5xx responses are common in CI and almost always pass on retry.
What this error means
npm install/npm ci fails partway through fetching packages with a network error or a 4xx/5xx from the registry. Re-running the job usually succeeds with no change.
npm output
npm error code ECONNRESET
npm error network request to https://registry.npmjs.org/... failed,
reason: read ECONNRESETCommon causes
Transient network or registry instability
Brief connectivity blips or registry load cause resets, timeouts, and 503s. None reflect a problem with your project.
Rate limiting on shared CI IPs
Unauthenticated, high-volume installs from shared runner IPs can be throttled (429).
How to fix it
Add registry retries
npm has built-in fetch retry settings; raise them in CI.
Terminal
npm config set fetch-retries 5
npm config set fetch-retry-factor 2
npm config set fetch-retry-mintimeout 10000
npm ciCache and mirror
- Cache
~/.npmbetween runs so most installs are local. - Use a registry proxy/mirror or your own private registry to reduce external calls.
- Authenticate to raise rate limits.
How to prevent it
- Cache the npm download cache keyed on your lockfile.
- Pin dependencies with a committed lockfile and
npm ci. - Use a mirror for high-volume pipelines.
Related guides
Docker "toomanyrequests: rate limit exceeded" - Fix Docker Hub Pull LimitsFix Docker Hub "toomanyrequests: You have reached your pull rate limit" in CI by authenticating, caching imag…
Self-Healing CI: Auto-Retrying Transient Registry and 5xx FailuresRegistry timeouts, 429s, and 5xx errors are transient by definition. See why they happen and how self-healing…
npm ERESOLVE "unable to resolve dependency tree" - Fix Peer ConflictsFix npm ERESOLVE "unable to resolve dependency tree" peer dependency conflicts in CI - properly, without blin…
Self-Healing CI: Handling Network Timeouts and Flaky ConnectionsNetwork timeouts during dependency downloads and API calls are transient. Learn the manual mitigations and ho…