Skip to content
MtrXTools

npm ERR! code SELF_SIGNED_CERT_IN_CHAIN

npm sees an untrusted root certificate

Seen in npm, npx, yarn and pnpm behind corporate proxies

The certificate chain npm received ends in a root that Node.js doesn't trust, almost always a corporate or private CA.

Common causes

  • A TLS-inspecting proxy, firewall or antivirus (Zscaler, Netskope and similar) re-signs registry traffic.
  • A private registry uses a certificate from an internal CA.

How to fix it

  1. Export the corporate root CA as PEM and run npm config set cafile /path/to/corp-ca.pem.
  2. Or set NODE_EXTRA_CA_CERTS=/path/to/corp-ca.pem so every Node.js tool trusts it.
  3. Ask IT for the CA file rather than setting strict-ssl=false, which turns off verification.
See the certificate the registry really sends

Got a different message? Paste it into the error explainer.

Related errors

All 31 Dev tools & SSH errors