“npm error code ECONNREFUSED” on Mac
ECONNREFUSED reports a refused connection. Node.js documentation says: “No connection could be made because the target machine actively refused it.”
My Mac has this problem: “npm error code ECONNREFUSED” on Mac. Read https://kilobat.app/guides/npm-econnrefused.md and work through it with me. Install the Kilobat CLI if it’s missing: brew install seifip/kilobat/kilobat. Run the guide’s Terminal and kilobat checks yourself and tell me what you find. List the steps only I can do. Ask before you change any setting.
Symptoms
npm installor a script stops withnpm error code ECONNREFUSED.- The next line names an address and a port, such as
127.0.0.1:8080. - It often follows a proxy or registry setting.
Likely causes
- A proxy setting that points to nothing. A proxy on
127.0.0.1or another host is set, but no proxy runs there. - A local registry that is off. A local mirror or cache is down.
- A service that is inactive. Node.js documentation says this usually results from a service that is inactive on the remote host.
- A script that calls a local server. A test or build step can call a server that has not started.
How to check
Read the address and port in the error.
Show npm’s proxy and registry.
npm config get proxy npm config get https-proxy npm config get registryTest that port.
nc -vz 127.0.0.1 8080Show the proxy variables.
env | grep -i proxy
How to fix it
Delete a proxy setting that you do not need.
npm config delete proxy npm config delete https-proxyStart the local registry or server that the address names.
Unset wrong proxy variables.
unset https_proxy http_proxyRetry the install.
Questions
Is ECONNREFUSED the same as ECONNRESET?
No. ECONNREFUSED is a refusal at the start. ECONNRESET closes an open connection. See “npm error code ECONNRESET” on Mac.
Why does it name 127.0.0.1?
npm tried a local address, usually from a proxy or registry setting.
Sources
Checked on 29 October 2026.