Fix 'unable to get local issuer certificate' in npm, Node.js, git and curl
Trust your corporate proxy or custom CA properly with NODE_EXTRA_CA_CERTS instead of disabling TLS verification.
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY npm ERR! request to https://registry.npmjs.org/ failed, reason: unable to get local issuer certificate
# Node.js / npm / npx export NODE_EXTRA_CA_CERTS="/etc/ssl/certs/corp-root-ca.pem" npm config set cafile "/etc/ssl/certs/corp-root-ca.pem" # git git config --global http.sslCAInfo "/etc/ssl/certs/corp-root-ca.pem" # curl curl --cacert "/etc/ssl/certs/corp-root-ca.pem" https://registry.npmjs.org/ # Node 23.8+ can also use the OS trust store: NODE_OPTIONS="--use-system-ca" npm install
Root Cause & Mechanism Analysis
Why does this error occur?
A TLS-inspecting corporate proxy, antivirus, or self-signed internal server re-signs HTTPS traffic with a root CA that Node.js, npm, git, or curl do not trust. Node.js uses its own bundled CA store, not the operating system's.
Frequently Asked Questions
Where do I get the corporate CA file?
Need Zero-Knowledge .env Secret Sync Across Your Engineering Team?
Explore Castov Env Vault for client-side AES-256-GCM encrypted environment sharing, or sponsor this engineering hub.
Related Developer Error Solutions
Browse All 69 GuidesSSL: NET::ERR_CERT_AUTHORITY_INVALID
Resolve SSL/TLS certificate trust errors in development, curl, Node.js, and local HTTPS environments.
npm ERR! code EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
Stop using sudo npm. Reconfigure npm's global prefix or use a Node version manager so global installs and npx work without root.
SSH: WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! Host key verification failed
Safely remove a stale host key from known_hosts after a server rebuild or IP reuse, and verify the new fingerprint before trusting it.