Issue 1:
Is there an existing issue for this?

I have searched the existing issues

This issue exists in the latest npm version

I am using the latest npm

Current Behavior

npm install doesn't work either way. After upgrading Node JS to v17.4.0 and npm to v8.4.0 npm install gives two errors with different packages every time which completely halts or crashes the process.

PS E:\VS projs\react-app> npx create-react-app app

Creating a new React app in E:\VS projs\react-app\app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ERR_SSL_CIPHER_OPERATION_FAILED
npm ERR! A4250000:error:1C800066:Provider routines:ossl_gcm_stream_update:cipher operation
failed:c:\ws\deps\openssl\openssl\providers\implementations\ciphers\ciphercommon_gcm.c:312:
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ruturaj_k\AppData\Local\npm-cache\_logs\2022-01-30T09_11_05_521Z-debug-0.log

Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Deleting app/ from E:\VS projs\react-app
Done.

I felt I had this issue only on my machine so I checked out on different machine with macOS platform and firstly it produces the above error and then when ran second time it give the SOCKET_TIMEOUT error.

There's still more to this

I checked with another machine with windows platform and sadly it doesn't work there either. I tested it with a highspeed connection and it's still the same :( .

2022-01-31T09_34_56_431Z-debug-0.log

Expected Behavior

Expected to install the required packages and create a react app.

Expected to install global modules without any error

Expected output

Steps To Reproduce

Open Terminal / Command Prompt

Type npm install -g nodemon or npx create-react-app my-app

Fetches some packages.

Creating a new React app in E:\VS projs\react-app\app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

Then suddenly logs an error stoping the install.

npm ERR! code ERR_SSL_CIPHER_OPERATION_FAILED
npm ERR! A4250000:error:1C800066:Provider routines:ossl_gcm_stream_update:cipher operation
failed:c:\ws\deps\openssl\openssl\providers\implementations\ciphers\ciphercommon_gcm.c:312:
npm ERR!

and sometimes

verbose npm v8.4.0
4743 error code ERR_SOCKET_TIMEOUT
4744 error errno ERR_SOCKET_TIMEOUT
4745 error network Invalid response body while trying to fetch https://registry.npmjs.org/dotenv: Socket timeout
4746 error network This is a problem related to network connectivity.
4746 error network In most cases you are behind a proxy or have bad network settings.
4746 error network
4746 error network If you are behind a proxy, please make sure that the
4746 error network 'proxy' config is set properly. See: 'npm help config

Environment

npm: v8.4.0

Node.js: v17.4.0

OS Name: Windows 10 Pro Build 9043.1503 Version 21H1

npm config:

npm config ls `; "builtin" config from C:\Users\ruturaj_k\AppData\Roaming\npm\node_modules\npm\npmrc

prefix = "C:\\Users\\ruturaj_k\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\WINDOWS\system32
; HOME = C:\Users\ruturaj_k
; Run `npm config ls -l` to show all defaults.` here

Issue 2:
Current Behavior:

When trying to install packages, without a previous cache, we get constant timeouts when trying to fetch packages, both locally and in a CI environment. The package that fails is always different, so there isn't a specific package causing the issue.

Stack trace:

19505 verbose stack FetchError: request to https://.../npm/registry/typescript/-/typescript-4.1.3.tgz failed, reason: Socket timeout
19505 verbose stack at ClientRequest.<anonymous> (C:\npm\prefix\node_modules\npm\node_modules\minipass-fetch\lib\index.js:97:14)
19505 verbose stack at ClientRequest.emit (events.js:315:20)
19505 verbose stack at TLSSocket.socketErrorListener (_http_client.js:469:9)
19505 verbose stack at TLSSocket.emit (events.js:327:22)
19505 verbose stack at emitErrorNT (internal/streams/destroy.js:106:8)
19505 verbose stack at emitErrorCloseNT (internal/streams/destroy.js:74:3)
19505 verbose stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
19506 verbose cwd D:\a\1\s
19507 verbose Windows_NT 10.0.17763
19508 verbose argv "C:\\hostedtoolcache\\windows\\node\\14.15.4\\x64\\node.exe" "C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js" "ci" "--no-audit"
19509 verbose node v14.15.4
19510 verbose npm v7.9.0
19511 error code ERR_SOCKET_TIMEOUT
19512 error errno ERR_SOCKET_TIMEOUT
19513 error request to https://.../npm/registry/typescript/-/typescript-4.1.3.tgz failed, reason: Socket timeout
19514 verbose exit 1

Tried using the fetch-retries, fetch-retry-mintimeout, and fetch-retry-maxtimeout options, but didn't seem to have any effect.

Expected Behavior:

Install packages without timing out.

Steps To Reproduce:

Using a project with workspaces (~6425 packages)

No cache available

Run npm ci

Environment:

OS: Mac OS 11.2.3 or Windows 10

Node: 14.15.4

npm: 7.9.0