The CERT_REVOKED error occurs when npm cannot verify the SSL/TLS certificate of the npm registry due to certificate revocation, outdated CA bundles, or network interference. This typically happens with older Node.js versions or corporate proxies.
This error indicates that npm cannot establish a secure connection to the npm registry because the SSL/TLS certificate has been revoked or cannot be verified. The certificate revocation can occur for several reasons: the npm registry's certificate was actually revoked by its certificate authority, your system's certificate bundle is outdated and doesn't recognize the registry's CA chain, your system clock is out of sync causing certificate validation to fail, or a corporate proxy/firewall is intercepting the connection and presenting an untrusted certificate. When npm tries to download packages, it verifies the server's certificate against a chain of trusted Certificate Authorities (CAs). If any link in that chain is broken, revoked, or not in your system's trusted store, the connection fails with CERT_REVOKED or related errors.
An incorrect system clock is the most common cause. Ensure your system time is synchronized:
On Linux:
sudo timedatectl set-ntp true
sudo systemctl restart systemd-timesyncdOn macOS:
sudo systemsetup -setusingnetworktime onOn Windows:
- Go to Settings > Time & Language > Date & time
- Toggle 'Set time automatically' off and back on
Verify the current time is correct by visiting https://www.timeanddate.com/
Outdated versions of Node.js include old CA certificate bundles. Update to the latest stable release:
Using nvm (recommended):
nvm install node
nvm use node
npm install -g npm@latestOr download directly from https://nodejs.org/ and install the latest LTS version.
Verify the update:
node --version
npm --versionClear the npm cache to remove any corrupted certificate data:
npm cache clean --forceThen try your npm command again:
npm installIf you're behind a corporate proxy or firewall, you may need to specify additional CA certificates:
Option A - Set NODE_EXTRA_CA_CERTS environment variable:
export NODE_EXTRA_CA_CERTS=/path/to/company-ca.crt
npm installOption B - Configure npm to use a specific CA file:
npm config set cafile /path/to/company-ca.crtGet your company's root CA certificate from your IT department.
If all else fails, you can temporarily disable strict SSL checking. Use only for development on trusted networks:
npm config set strict-ssl falseTo verify the setting:
npm config get strict-sslRe-enable it when done:
npm config set strict-ssl trueWARNING: Disabling SSL verification exposes you to man-in-the-middle attacks. This should only be used temporarily in development environments.
For corporate environments: If you're behind a proxy using tools like Zscaler, Kaspersky, or Palo Alto Networks, the issue is likely certificate interception. Contact your IT department for the root CA certificate and use the NODE_EXTRA_CA_CERTS environment variable rather than disabling SSL entirely. For antivirus issues: Some security software can interfere with SSL connections. Try temporarily disabling it to confirm, then whitelist Node.js/npm if the issue resolves. Check the npm status page at https://status.npmjs.org for any service disruptions.
npm ERR! code E401 npm ERR! 401 Unauthorized - Token has expired
Token has expired - npm authentication failure
npm ERR! code EAI_NODATA npm ERR! errno EAI_NODATA npm ERR! getaddrinfo EAI_NODATA registry.npmjs.org
How to fix "npm ERR! code EAI_NODATA - getaddrinfo EAI_NODATA"
npm ERR! code EMPTYPACKAGE npm ERR! Package contains no files
How to fix 'npm ERR! code EMPTYPACKAGE' - Package contains no files
npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: packages/missing
How to fix "npm ERR! code EWORKSPACEMISSING - Workspace does not exist" error
npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Address not available
How to fix "npm ERR! code EADDRNOTAVAIL - Address not available" error