最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - npm error code ERR_SSL_CIPHER_OPERATION_FAILED after Windows 11 update - Stack Overflow

programmeradmin2浏览0评论

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 /@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 .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 /
    
  • 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:

  • Node version - 20.17.0
  • NPM version - 11.1.0
  • OS - Windows 11

How can I fix this issue?

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./@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./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./
    
  • 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:

  • Node version - 20.17.0
  • NPM version - 11.1.0
  • OS - Windows 11

How can I fix this issue?

Share Improve this question edited Mar 10 at 7:46 Preethi asked Mar 7 at 17:04 PreethiPreethi 231 silver badge6 bronze badges 3
  • registry.npmjs. redirects to HTTPS since 2016. nodejs. builds for Windows contain an internal copy of OpenSSL and don't use any (other) you download, but since you have done so, try commandline openssl s_client -connect registry.npmjs.:443 -cipher AESGCM <NUL and see if it works or gives a similar or different error. How are you connecting to the Internet -- is it through anyone that might intercept TLS traffic, such as a business, agency, or school? – dave_thompson_085 Commented Mar 7 at 20:13
  • I'm using mobile hotspot – Preethi Commented Mar 8 at 5:15
  • Thank you @dave_thompson_085! Running the command you suggested helped me identify the issue. I got 'Verify return code: 20 (unable to get local issuer certificate)' but managed to resolve it. Really appreciate your help! – Preethi Commented Mar 9 at 3:43
Add a comment  | 

1 Answer 1

Reset to default 1

Fix:

I ran the command suggested: openssl s_client -connect registry.npmjs.: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.

  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.

发布评论

评论列表(0)

  1. 暂无评论