Common causes
- A corporate network or proxy performs SSL inspection using its own CA certificate
- You're connecting to a development or staging server with a self-signed cert
- The CA certificate for an internal server hasn't been added to Node.js's trusted store
- npm is being proxied through a tool that intercepts HTTPS traffic
How to fix it
- For corporate CA: add the certificate to Node.js: NODE_EXTRA_CA_CERTS=/path/to/cert.pem npm install
- For npm registry issues: npm config set cafile /path/to/corporate-ca.pem
- As a last resort for development only (never production): NODE_TLS_REJECT_UNAUTHORIZED=0 npm install
- Ask your IT/network team for the corporate CA certificate to add properly
Example
Error: self-signed certificate in certificate chain
at TLSSocket.onConnectSecure (node:_tls_wrap:1659:34)
at TLSSocket.emit (node:events:514:28)Running npm install behind a corporate proxy that performs HTTPS inspection
Have a different error?
Paste any error message into the Error Translator to get an instant explanation.
