ECONNREFUSED means something answered the connection attempt with an active refusal - nothing is listening on that host/port. Unlike a timeout, the network reached the target and was told "no".
What this error means
npm install fails with connect ECONNREFUSED and an IP:port. It frequently points at 127.0.0.1 or an internal mirror address, meaning the configured registry or proxy is down or on the wrong port.
An .npmrc pointing at a local registry proxy (e.g. Verdaccio on 127.0.0.1:4873) gets refused when that service is not started in CI.
Wrong proxy host or port
A proxy/https-proxy setting pointing at a port nothing listens on causes every request to be refused immediately.
How to fix it
Point npm at a reachable registry
Verify the registry/proxy address and that the service is actually up.
Terminal
npm config get registry
npm config get proxy
# fall back to the public registry if the mirror is down
npm config set registry https://registry.npmjs.org/
npm ci
Bring up or bypass the mirror
Ensure any local registry proxy is started before npm ci in the job.
Clear stale proxy/https-proxy settings if no proxy is needed.
Confirm the mirror listens on the host/port your .npmrc references.
How to prevent it
Start internal mirrors before the install step.
Keep proxy settings accurate or unset.
Have a public-registry fallback for mirror outages.
Frequently asked questions
What causes ""npm error code ECONNREFUSED""?
An .npmrc pointing at a local registry proxy (e.g. Verdaccio on 127.0.0.1:4873) gets refused when that service is not started in CI.
How do I fix "npm error code ECONNREFUSED"?
Verify the registry/proxy address and that the service is actually up.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.