I tried to install a package with yarn earlier today and I got this
yarn install
yarn install v1.9.4
[1/4]
i had a different error, but the same network connection issue. i read through this thread: https://github.com/yarnpkg/yarn/issues/15
and ended up uninstalling/reinstalling node/npm which fixed my issue. maybe there's something wrong with your node installation too?
retrying few times worked out for me on similar issue.
I have tried a lot:
npm clean cache
yarn clean cache
yarn config delete proxy
yarn config delete https-proxy
yarn config delete registry
yarn install --network-timeout 1000000
finally it works!
Check your internet speed / strength of connection. I had this problem while I was on a spotty public wifi. Noticed that it was a different package that threw the error each time I tried. And once I got faster / more stable internet this problem went away. (The packages were too large for my poor connection).
Try clearing your cache
$ yarn cache clean
$ yarn // to install dependencies, no need for "yarn install"
Approach 2
$ yarn install --network-timeout 1000000
Reference https://github.com/yarnpkg/yarn/issues/4890#issuecomment-358179301
If you are using WSL for linux just add the current ip domain in: C:\Windows\System32\drivers\etc\hosts e.g:
104.16.21.35 registry.yarnpkg.com