node.jssslnpmopensslca

npm error code ERR_SSL_CIPHER_OPERATION_FAILED after Windows 11 update


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:

System details:

How can I fix this issue?


Solution

  • 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:

    1. I installed the certificate from here. "GTS Root R4" certificate is used by npmjs.org

    2. Added certificate path using this command setx NODE_EXTRA_CA_CERTS <path to certificate>

    3. 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.