npm ECONNRESET in CI - Fix Dropped Registry Connections
By Daniel Zoghalchali·Latchkey
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.
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 ci
Cache 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.
Frequently asked questions
What causes ""npm ERR! code ECONNRESET""?
A proxy, load balancer, or registry node drops the connection mid-transfer, which is unrelated to your project.