After a system update, I started getting the following error when trying to install packages with npm install
npm error code ERR_SSL_CIPHER_OPERATION_FAILED
npm error errno ERR_SSL_CIPHER_OPERATION_FAILED
npm error Invalid response body while trying to fetch https://registry.npmjs.org/@types%2Fjsonwebtoken: A0090000:error:1C800066:Provider routines:ossl_gcm_stream_update:cipher operation failed:c:\ws\deps\openssl\openssl\providers\implementations\ciphers\ciphercommon_gcm.c:325:
npm error
npm error A complete log of this run can be found in
I am also unable to change my Node version, I receive the following error:
nvm install 22
Downloading node.js version 22.14.0 (64-bit)...
Error while downloading https://nodejs.org/dist/v22.14.0/node-v22.14.0-win-x64.zip: local error: tls: bad record MAC
Extracting node and npm...
Error extracting from Node archive: zip: not a valid zip file
error installing 22.14.0: failed to download v22.14.0 64-bit executable`
What I have tried:
Clearing the npm cache using npm cache clear --force
Reinstalling packages with npm install --force
Disabled strict SSL and switched to HTTP registry:
npm config set strict-ssl false
npm config set registry http://registry.npmjs.org/
I have also installed OpenSSL for Windows. I downloaded OpenSSL from here. When I run openssl version in my command prompt, I get:
OpenSSL 3.4.1 11 Feb 2025 (Library: OpenSSL 3.4.1 11 Feb 2025)
System details:
How can I fix this issue?
Fix:
I ran the command suggested: openssl s_client -connect registry.npmjs.org:443 -cipher AESGCM <NUL
. However, I got the error: Verify return code: 20 (unable to get local issuer certificate).
The CA certificate was missing. So, I followed these steps:
I installed the certificate from here. "GTS Root R4" certificate is used by npmjs.org
Added certificate path using this command setx NODE_EXTRA_CA_CERTS <path to certificate>
Verified the path using this command node -p "process.env.NODE_EXTRA_CA_CERTS"
If the correct file path is displayed, the setting was applied successfully.