Reputation: 2545
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.
Upvotes: 253
Views: 334872
Reputation: 3274
Just connect your computer to your phone's mobile hotspot to temporarily install the packages you need. I've had this issue before, and it weirdly enough resolves itself over time. Thus, I now just do the phone's data trick to get around it when it does pop up periodically.
Upvotes: 0
Reputation: 41
This happened to me because in MacOS I had the IPv6 address set as Automatically. So you can go to Settings > WiFi > Details > TCP/IP. Then set "Configure IPv6" to "Manually".
Upvotes: 0
Reputation: 4144
For some reason there was a connection issue when trying to perform the version check. Running the following fixed it for me:
yarn config set disable-self-update-check true
Upvotes: 0
Reputation: 29
I got this error while trying to run yarn install - i use WSL with ubuntu distro, the following command fixed it,
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
Upvotes: 0
Reputation: 3181
For me the problem was also with the proxy, but not the yarn proxy, the npm proxy. Type yarn config list
and if you see an npm proxy config at the bottom, after the yarn config parameters, you should use npm config set proxy http://user:[email protected]:port
and npm config set https-proxy https://user:[email protected]:port
to fix it.
Upvotes: 0
Reputation: 36
docker-compose build service1
but getting There appears to be trouble with your network connection. Retrying...
docker-compose build service1 --no--cache
yarn install
.Upvotes: 0
Reputation: 121
In my case
yarn install --verbose
gave me an error:
Error: connect ETIMEDOUT 2606:4700::6810:1822:443.
To investigate, I first tried to
ping registry.npmjs.org
and received a
Request timed out
response. Then, I tried using
ping -4 registry.npmjs.org
and got a correct response. Based on this, my solution is to turn off IPv6 in the connection properties.
Upvotes: 4
Reputation: 126
There are many solutions to this issue, none of which worked for me. After giving it some thought I realized I had just updated Docker. As Hail Mary I tried running Docker Desktop in administrator mode and to my surprise that solved the issue.
I'm not too sure why this was all of a sudden a requirement for my machine but if you find yourself clutching at straws give this a shot.
Upvotes: -1
Reputation: 493
turning off VPN solved the issue for me
Also check if you have enough space for installing new packages, I also didnt have enough space...
Upvotes: 0
Reputation: 8766
In my case it was Window's real-time protection which was causing the issue. Turn off the Real-time protection
till your package is installed. Then turn it ON.
Upvotes: 3
Reputation: 1501
Got the exact issue when trying yarn install
yarn install --network-timeout 100000
Just using this didn't solve my problem. I had to install only ~5 packages at a time. So I ran yarn install
multiple times with only few dependencies in the package.json at a time.
Hope this helpful
Upvotes: 8
Reputation: 20595
Simple working solution (right way of doing it):
Looks like yarn was trying to connect via a proxy. The following worked for me:
npm config rm proxy
npm config rm https-proxy
Upvotes: 40
Reputation: 57
I faced the same issue but adding VS Code to the Firewall Exception List has solved my issue.
Upvotes: -1
Reputation: 186
Adding option --network=host was the solution in my case.
docker build --network=host --progress=plain .
Upvotes: 1
Reputation: 983
If you are working within a docker environment or elsewhere that might need a different approach where you are not modifying the installation process, try adding a file named .yarnrc
in the root of the project with the problem (where your package.json resides) and in that file write:
network-timeout 600000
Docker will still run without modifying the docker-compose.yml file and you get the timeout solution.
Upvotes: 2
Reputation: 85
Deleting the yarn-lock file, doing a yarn cache clean and then a yarn solved my issue
Upvotes: 1
Reputation: 897
In short, this is caused when yarn is having network problems and is unable to reach the registry. This can be for any number of reasons, but in all cases, the error is the same, so you might need to try a bunch of different solutions.
Reason 1: Outdated Proxy Settings
This will throw the "network connection" error if you are connected to a network that uses a proxy and you did not update yarn configs with the correct proxy setting.
You can start running the below commands to check what the current proxy configs are set to:
yarn config get https-proxy
yarn config get proxy
If the proxy URLs returned are not what you expect, you just need to run the following commands to set the correct ones:
yarn config set https-proxy <proxy-url>
yarn config set proxy <proxy-url>
Similarly, if you have previously set up the proxy on yarn but are no longer using a network connection that needs a proxy. In this case, you just need to do the opposite and delete the proxy config:
yarn config delete https-proxy
yarn config delete proxy
Reason 2: Incorrect Domain name resolution
This will throw the "network connection" error if for whatever reason your machine cannot resolve your yarn registry URL to the correct IP-address. This would usually only happen if you (or your organization) are using an in-house package registry and the ip-address to the registry changes.
In this case, the issue is not with yarn but rather with your machine. You can solve this by updating your hosts
file (for mac users, this should be found in '/etc/hosts') with the correct values, by adding a mapping as follows:
<ip-address> <registry-base-url>
example:
10.0.0.1 artifactory.my.fancy.organiza.co.za
Upvotes: 4
Reputation: 5051
When I want to use yarn
I have above error, but there is not any error with npm
, for this situation you can install react project
from npm
npx create-react-app app --use-npm
Upvotes: 2
Reputation: 13329
yarn config set network-timeout 600000 -g
Often, your error is caused by hitting the network connection time limit, and yarn simply reports there is "trouble with your network connection".
The line of code at the top of my answer sets the global yarn network timeout to 10 minutes.
Having a long network timeout is probably okay, because yarn uses caches and if it's big and you don't have it, you probably want it to just go ahead and take the time to download.
Upvotes: 41
Reputation: 315
This happened in my case trying to run yarn install
.
My project is a set of many sub-projects. After a couple of retries, it showed a socket-timeout error log:
error An unexpected error occurred: "https://<myregitry>/directory/-/subProject1-1.0.2.tgz: ESOCKETTIMEDOUT".
I cloned subProject1
separately, did yarn install
on it and linked it with main project.
I was able to continue with my command on main project after that.
Once done, I unlinked the subProject1
and did a final yarn install --force
which was success.
Upvotes: 0
Reputation: 3073
In my case I found a reference to a defunct registry in my ~/.yarnrc file
When I removed that the error went away
Upvotes: 2
Reputation: 1190
Turn off or disable your antivirus before run this command. I am also facing same issue than i disable quick heal antivirus and it is works.
create-react-app my-app
Upvotes: 1
Reputation: 183
I encountered this error while attempting yarn outdated
. In my case, a few of the packages in my project were hosted in a private registry within the company network. I didn't realize my VPN was disconnected so it was initially confusing to see the error message whilst I was still able to browse the web.
It becomes quite obvious for those patient enough to wait out all five retry attempts. I, however, ctrl-c'd after three attempts... 😒
Upvotes: 1
Reputation: 402
The large package involved often can be Material Design Icons.
Check if you make use of the Material Design Fonts material-design-icons
in your package.json
and remove it!
material-design-icons
is too big to handle and you should only use material-design-icons-fonts
if you only need them.
Upvotes: 11
Reputation: 1382
The following helped me
yarn config delete https-proxy
yarn config delete proxy
they set your https-proxy and proxy values to undefined. My https-proxy was set to localhost. Check that proxy and https-proxy config values are undefined by using the following
yarn config get https-proxy
yarn config get proxy
Upvotes: 19
Reputation: 420
Could be a proxy issue. Run the command below to delete the proxy.
yarn config delete proxy
Upvotes: 14
Reputation: 1221
Deleting the yarn.lock file and rerunning "yarn install" worked for me.
Upvotes: 112
Reputation: 11029
Turning off "real time protection" with windows defender fixed it for me.
Sucks but it appears the checks are too much for yarn to handle.
Upvotes: 40