npm ECONNRESET in CI - Fix Dropped Registry Connections
ECONNRESET means the TCP connection to the registry was reset before the download finished. It is a transient network event that almost always passes on retry.
What this error means
npm install fails mid-fetch with code ECONNRESET and a read ECONNRESET reason. The job typically succeeds on a re-run with no project change.
npm
npm ERR! code ECONNRESET
npm ERR! network request to https://registry.npmjs.org/lodash failed,
reason: read ECONNRESETCommon causes
A reset connection during download
A proxy, load balancer, or registry node drops the connection mid-transfer, which is unrelated to your project.
High concurrency saturating connections
Many parallel fetches on a shared runner can trigger resets under load.
How to fix it
Add retries and reduce concurrency
- Raise fetch retries so a reset is retried automatically.
- Lower install concurrency if resets are frequent.
Terminal
npm config set fetch-retries 5
npm config set maxsockets 8
npm ciCache and mirror
- Cache ~/.npm so most packages resolve locally.
- Use a registry mirror to reduce exposure to resets.
How to prevent it
- Cache ~/.npm and raise fetch retries. On Latchkey managed runners, transient ECONNRESET drops are auto-retried and the registry is cached, so most resets resolve without intervention.
Related guides
npm Registry Errors in CI: ECONNRESET, ETIMEDOUT, and 5xxFix transient npm install failures in CI - ECONNRESET, ETIMEDOUT, 429, and 5xx from the registry - with retri…
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…
npm Registry 429 Too Many Requests in CI - Fix Rate LimitingFix npm registry 429 Too Many Requests errors in CI by authenticating, caching, and mirroring to stay under r…