Skip to content
Latchkey

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 ECONNRESET

Common 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

  1. Raise fetch retries so a reset is retried automatically.
  2. Lower install concurrency if resets are frequent.
Terminal
npm config set fetch-retries 5
npm config set maxsockets 8
npm ci

Cache and mirror

  1. Cache ~/.npm so most packages resolve locally.
  2. 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →