avoid ESOCKETTIMEDOUT while installing a large package on a slow disk #8363
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Avoid message
There appears to be trouble with your network connection. Retrying...
and ends up withESOCKETTIMEDOUT
during install a large package. Fixes #8242 and many potential duplicates.Summary
During install from a remote registry, the
tgz
package download is streamed to uncompress files at same time. When uncompress time is higher than the socket timeout, the network connection is lost to download next parts of tgz file.This issue is likely to occur:
This issue can be worked around by increasing the
network-timeout
option. However, the filesystem overhead is not really linked to network socket. Therefore a more appropriate solution is preferred.In order to fix the timeout error, the install process is split in two parts:
tgz
package is downloaded first to yarn cache.This is just a technical fix, impact is very isolated, therefore there is no need to update
CHANGELOG.md
Test plan
No regression on automated tests.
Yarn install failed on my machine with package @material-ui/icons 4.9.1 (16645 files) and default timeout 30s.
After the fix, yarn successfully install this package with network-timeout 5s only.