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”.
Symptoms
npm installstops withnpm 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
Show npm's registry and proxy settings.
npm config get registry npm config get proxy npm config get https-proxyAsk the registry for an answer.
npm pingTest the registry with curl. Look for the certificate issuer.
curl -v -o /dev/null https://registry.npmjs.org/ 2>&1 | grep -i issuerTry the install on another network, such as a phone hotspot.
How to fix it
If the network needs a proxy, set it for npm.
npm config set https-proxy http://proxy.example.com:8080If a company proxy inspects TLS, add its root certificate for Node.js. See Corporate proxy certificates break Terminal tools on a Mac.
Give npm more retries.
npm config set fetch-retries 5If a VPN, proxy or security app is on, turn it off for a short test. Turn it on again after the test.
With Kilobat
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/These Kilobat checks are free. AI agents run them through MCP with
diagnose_connectionanddiagnose_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
- Node.js documentation: Common system errors
- intro(2), ECONNRESET, man page installed with macOS 27.2
- npm Docs: config
- curl(1), man page installed with macOS 27.2
Sources checked on 29 October 2026. Man pages are the ones installed with macOS; open one with man <name> in Terminal.