“UNABLE_TO_GET_ISSUER_CERT_LOCALLY” on Mac
UNABLE_TO_GET_ISSUER_CERT_LOCALLY means that Node.js cannot find the authority that signed a certificate. A TLS-inspecting proxy or a private authority is the usual cause.
My Mac has this problem: “UNABLE_TO_GET_ISSUER_CERT_LOCALLY” on Mac. Read https://kilobat.app/guides/npm-unable-to-get-issuer-cert-locally.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
- A Node.js tool stops with
UNABLE_TO_GET_ISSUER_CERT_LOCALLY. - The message may say
unable to get local issuer certificate. - Browsers may open the same site.
Likely causes
- A TLS-inspecting proxy. A work proxy signs traffic with its own certificate. See Corporate proxy certificates break Terminal tools on a Mac.
- A private authority. A company registry or gateway uses a certificate from an authority that Node.js does not know.
- A security app that scans HTTPS. It adds its own root, which Node.js does not use by default.
- A missing intermediate. A server may omit part of its certificate chain.
How to check
Read the issuer.
curl -v -o /dev/null https://registry.npmjs.org/ 2>&1 | grep -i issuerShow the CA file that npm uses.
npm config get cafileShow the Node.js CA variable.
echo $NODE_EXTRA_CA_CERTSTry a phone hotspot.
How to fix it
Get the CA certificate from the network administrator, in PEM format.
Tell Node.js to trust it for this shell.
export NODE_EXTRA_CA_CERTS=/path/to/ca.pemFor npm, set the same file.
npm config set cafile /path/to/ca.pemDo not set
NODE_TLS_REJECT_UNAUTHORIZED=0. It turns off all checks.
With Kilobat
Kilobat's connection doctor tests the host layer by layer. The TLS layer shows a certificate that this Mac does not trust.
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
Why does the browser work?
macOS trusts certificates that an administrator installs. Node.js uses its own list unless you add a file.
Is setting NODE_TLS_REJECT_UNAUTHORIZED=0 a fix?
No. It turns off certificate validation for every connection. Add the CA instead.
Sources
Checked on 29 October 2026.