Error messages

“npm error code ECONNRESET” on Mac

ECONNRESET means that the other side closed the connection by force. Node.js documentation calls it “Connection reset by peer”.

Applies to: npm 10 and later print “npm error”. Older versions print “npm ERR!”. All current macOS versions.Checked: 29 October 2026

Symptoms

  • npm install stops with npm error code ECONNRESET.
  • npm adds that this is a problem related to network connectivity.
  • It happens on a company network, a VPN or with a security app.

Likely causes

  • A proxy or filter that resets connections. A company proxy or security software can close connections that it does not allow.
  • TLS inspection. A proxy that inspects secure traffic can break the connection. See Corporate proxy certificates break Terminal tools on a Mac.
  • A VPN that reconnects. Connections through the VPN close when it reconnects.
  • An unstable connection. Node.js documentation says that a timeout or a reboot on the remote side can cause it.

How to check

  1. Show npm's registry and proxy settings.

    npm config get registry
    npm config get proxy
    npm config get https-proxy
  2. Ask the registry for an answer.

    npm ping
  3. Test the registry with curl. Look for the certificate issuer.

    curl -v -o /dev/null https://registry.npmjs.org/ 2>&1 | grep -i issuer
  4. Try the install on another network, such as a phone hotspot.

How to fix it

  1. If the network needs a proxy, set it for npm.

    npm config set https-proxy http://proxy.example.com:8080
  2. If a company proxy inspects TLS, add its root certificate for Node.js. See Corporate proxy certificates break Terminal tools on a Mac.

  3. Give npm more retries.

    npm config set fetch-retries 5
  4. If a VPN, proxy or security app is on, turn it off for a short test. Turn it on again after the test.

With Kilobat

  1. Kilobat's connection doctor tests the registry layer by layer: network, proxy, DNS, rules, IPv4, IPv6, TLS and the server. It names the layer that failed.

    kilobat why https://registry.npmjs.org/
  2. These Kilobat checks are free. AI agents run them through MCP with diagnose_connection and diagnose_network. See Find why one site or API won't connect.

Questions

Is ECONNRESET a bug in my project?

Usually not. The connection to the registry closed. Run the same install on another network to compare.

Sources

Sources checked on 29 October 2026. Man pages are the ones installed with macOS; open one with man <name> in Terminal.