@material-ui/iconsをインストールする際のESOCKETTIMEDOUTエラーの解決方法

yarnを使って@material-ui/iconsをインストールする際にエラーが発生した。

対応方法

.yarnrcをプロジェクトのルートディレクトリ(package.jsonとかあるところ)に作成し、ファイルの中身を以下のように設定する。
(設定内容は、タイムアウトを10分にするというもの)

network-timeout 600000

ファイルの作成が終わったら通常通り、yarn add @material-ui/iconsでインストール出来る。
※ インストールには数分時間がかかる事があるので、キャンセルせずにちゃんと待つ

現象と調査方法

エラー発生時のログは以下の通り

> yarn add @material-ui/icons
yarn add v1.16.0
[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/@material-ui/icons/-/icons-4.9.1.tgz: ESOCKETTIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\hogehogehoge\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

ググったら割とすぐに出てくる github.com

where the number is milliseconds to wait (600000ms = 10min) Please note that even if it doesn't timeout during the download, it's still probably going to take several minutes to un-tar the archive, since it has somewhere close to 90,000 files in it 😞

ざっくり訳すと、ダウンロード中にタイムアウトしなくても、9万近くのファイルが入っているので、アーカイブを解凍するのに数分かかるっぽい。
この解決方法は結構すぐ見つけられるんだけど、あまりにも待ち時間が長いからキャンセルしたりしていたので、備忘録に残す。

時間かかっても安心して待とうねという話