Skip to content

Commit 4757c78

Browse files
authored
docs: add gotcha for yarn timeout (#30)
1 parent 7e6be6d commit 4757c78

File tree

5 files changed

+67
-0
lines changed

5 files changed

+67
-0
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

gotchas/yarn-install-timeout.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
When running `yarn install` in projects which depend on very large packages Yarn hits the timeout limit and eventually throws the error `ESOCKETTIMEDOUT`.
2+
3+
```sh
4+
yarn install
5+
6+
yarn install v1.13.0
7+
[1/4] Resolving packages...
8+
[2/4] Fetching packages...
9+
info There appears to be trouble with your network connection. Retrying...
10+
info There appears to be trouble with your network connection. Retrying...
11+
info There appears to be trouble with your network connection. Retrying...
12+
info There appears to be trouble with your network connection. Retrying...
13+
error An unexpected error occurred: "<some package name>: ESOCKETTIMEDOUT".
14+
info If you think this is a bug, please open a bug report with the information provided in "/home/varl/dev/dhis2/apps/dashboards-app/yarn-error.log".
15+
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
16+
```
17+
18+
## Troubleshooting
19+
20+
It is helpful to run the `yarn install` command with the `--verbose` switch to get additional information as well.
21+
22+
```sh
23+
yarn install --verbose
24+
25+
yarn install v1.13.0
26+
verbose 0.568 Found configuration file "/home/varl/.yarnrc".
27+
verbose 0.568 Checking for configuration file "/home/.yarnrc".
28+
verbose 0.572 current time: 2019-03-15T07:25:03.674Z
29+
[1/4] Resolving packages...
30+
[2/4] Fetching packages...
31+
verbose 13.542 Performing "GET" request to "https://registry.yarnpkg.com/material-ui/-/material-ui-0.20.2.tgz".
32+
info There appears to be trouble with your network connection. Retrying...
33+
verbose 13.638 Error: https://registry.yarnpkg.com/@dhis2/d2-i18n/-/d2-i18n-1.0.4.tgz: ESOCKETTIMEDOUT
34+
at ClientRequest.<anonymous> (/usr/share/yarn/lib/cli.js:130024:19)
35+
at Object.onceWrapper (events.js:277:13)
36+
at ClientRequest.emit (events.js:189:13)
37+
at TLSSocket.emitRequestTimeout (_http_client.js:662:40)
38+
at Object.onceWrapper (events.js:277:13)
39+
at TLSSocket.emit (events.js:189:13)
40+
at TLSSocket.Socket._onTimeout (net.js:443:8)
41+
at ontimeout (timers.js:436:11)
42+
at tryOnTimeout (timers.js:300:5)
43+
at listOnTimeout (timers.js:263:5)
44+
error An unexpected error occurred: "https://registry.yarnpkg.com/@dhis2/d2-i18n/-/d2-i18n-1.0.4.tgz: ESOCKETTIMEDOUT".
45+
info If you think this is a bug, please open a bug report with the information provided in "/home/varl/dev/dhis2/apps/dashboards-app/yarn-error.log".
46+
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
47+
```
48+
49+
## Solution
50+
51+
Increasing the `network-timeout` for Yarn is one way to fix it. You can choose to increase the limit globally or per-project. I did it globally in the example below. The configuration option accepts milliseconds. Here I set it to 10 minutes for _**OVERKILL**_ 😎.
52+
53+
```sh
54+
yarn config set network-timeout 600000 -g
55+
56+
yarn config v1.13.0
57+
success Set "network-timeout" to "600000".
58+
Done in 0.04s.
59+
```
60+
61+
## Bonus solution
62+
63+
The only package I've seen this problem on is the [`material-design-icons`](https://www.npmjs.com/package/material-design-icons) package which has a ridiculous amount of files in a large package format. If you only need the iconfont, the [`material-design-icons-iconfont`](https://github.com/Jossef/material-design-icons-iconfont) works as a drop-in replacement and is a lot smaller (package-wise).
64+
65+
## Discussion
66+
67+
- [dhis2/notes](https://github.com/dhis2/notes/issues/29)

0 commit comments

Comments
 (0)