Yarn - There appears to be trouble with your network connection. Retrying

I have been trying to do the quickstart guide for react native, but kept getting this error

There appears to be trouble with your network connection. Retrying...

My connection works just fine.


Solution 1:

This happens when your network is too slow or the package being installed is too large, and Yarn just assumes it's a network problem. Try increasing Yarn network timeout:

yarn add <yourPackage> --network-timeout 100000

Solution 2:

Deleting the yarn.lock file and rerunning "yarn install" worked for me.