yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

ESOCKETTIMEDOUT yarn add @mui/icons-material #8754

Open sebascomeau opened 2 years ago

sebascomeau commented 2 years ago

I can't fetch @mui icons-material package. I've fixed this problem in the past using network-timeout 500000 but it doesn't work. I can download it with the browser and also with curl in the same terminal and it take about 3 sec. I'm behind a proxy but other packages can be fetch without issue.

Yarn version: 1.22.17 Node version: 16.13.1

I've tried with these flag but same issue

--network-timeout 500000
--https-proxy http://{domain}:443

Here's the error

$ yarn add @mui/icons-material 
yarn add v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.2.4.tgz: read ECONNRESET".
info If you think this is a bug, please open a bug report with the information provided in "C:\\{path}\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Here more details with --verbose flag

verbose 59.0146269 Performing "GET" request to "https://registry.yarnpkg.com/typescript".
verbose 67.0063018 Request "https://registry.yarnpkg.com/typescript" finished with status code 200.
verbose 67.0093117 Performing "GET" request to "https://registry.yarnpkg.com/@mui%2ficons-material".
verbose 68.0091701 Request "https://registry.yarnpkg.com/@mui%2ficons-material" finished with status code 200.
[2/4] Fetching packages...
verbose 70.2464171 Performing "GET" request to "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.2.4.tgz".
info There appears to be trouble with your network connection. Retrying...
verbose 113.0090079 Performing "GET" request to "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.2.4.tgz".
info There appears to be trouble with your network connection. Retrying...
verbose 164.1962125 Performing "GET" request to "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.2.4.tgz".
info There appears to be trouble with your network connection. Retrying...
verbose 201.5115152 Performing "GET" request to "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.2.4.tgz".
info There appears to be trouble with your network connection. Retrying...
verbose 239.7794029 Performing "GET" request to "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.2.4.tgz".
verbose 302.9353585 Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:220:20)
error An unexpected error occurred: "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.2.4.tgz: read ECONNRESET".
info If you think this is a bug, please open a bug report with the information provided in "C:\\{path}\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Related issue in material-ui repo https://github.com/mui-org/material-ui/issues/20559#issuecomment-996709859

Canopix commented 2 years ago

I have the same issue on my GItlab.

fsawadyp commented 2 years ago

Any updates on this?

TKirtan commented 2 years ago

Any updates on this?

am also facing same issue

rally25rs commented 2 years ago

Internally yarn uses the request package to make http requests to download the files from npm.

https://github.com/yarnpkg/yarn/blob/6db39cf0ff684ce4e7de29669046afb8103fce3d/src/util/request-manager.js#L210-L214

https://www.npmjs.com/package/request

In the couple times I've tried to dig into this, I've never been able to reproduce the issue. I can only assume that something in request is catching the ECONNRESET

It seems like there have been a few issues filed against request pertaining to an ECONNRESET when using a proxy. THe first couple I clicked were just closed due to inactivity https://github.com/request/request/issues?q=is%3Aissue+ECONNRESET

Has anyone tried this in Yarn 2 instead? request and yarn 1 are both no longer receiving regular updates. Moving to yarn 2 would likely be a good plan either way.

eloudsa commented 2 years ago

I had the same issue with the following settings:

Using the verbose parameters, I saw that the issue was located here: Performing "GET" request to "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.6.2.tgz"

On my side, the following command worked for me: yarn add @mui/icons-material --network-timeout 500000

Jowaini commented 2 years ago

in my case: it returned network error and my connection was good but no installation of dependencies
but by this command fixed

yarn add @mui/icons-material --network-timeout 500000

Whilconn commented 2 years ago

try this https://github.com/yarnpkg/yarn/issues/8724#issuecomment-1301928867

AugustoCustodio commented 1 year ago

I had the same issue, yarn add @mui/icons-material --network-timeout 500000 worked for me!

askurat commented 1 year ago

I am running into this same issue but can't seem to get past it. I have tried what @Jowaini has suggested and what @Whilconn to no avail.

multivoltage commented 1 year ago

I can fix using this flag but in a CI?

hrodrig commented 10 months ago

in our Dockerfile, to fix this,

....
21:29:56  116.2 info There appears to be trouble with your network connection. Retrying...
21:29:56  138.2 info There appears to be trouble with your network connection. Retrying...
21:29:56  172.5 error An unexpected error occurred: "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.11.0.tgz: ESOCKETTIMEDOUT".
21:29:56  172.5 info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
21:29:56  172.5 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
....

we can use:

...
RUN npm cache clean --force && export http_proxy="" && export https_proxy="" && yarn config delete proxy && npm config rm https-proxy && npm config rm proxy && yarn install --check-files --network-timeout 1000000
...

slowly, but works !!!

michmerr commented 2 months ago

We've seen this intermittently, and bumping our network-timeout to 600000 had worked around it until recently. (Possibly due to more aggressive virus scanning.)

I think the error message is a little misleading because the module downloads quickly, but then takes a long time to extract into the yarn cache.

[For us,] This only happens with @mui/icons-material and @material-ui/icons. Is it the sheer number of files stuffed into it, or some other characteristic of the compression used?