Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
MichelDiz opened this issue Jan 20, 2018 · 100 comments · Fixed by redwoodjs/redwood#1042
Closed
Assignees
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+. triaged

Comments

@MichelDiz
Copy link

Do you want to request a feature or report a bug?
maybe

What is the current behavior?
PS. I tried to solve this by searching here and by Google, but not one approach solved it. I also uninstalled, cleaned up caches, rebooted mac. Clean DNS, Flush everything I could. I did everything I know.

After install zsh keeps saying "There appears to be trouble with your network connection. Retrying..."

error An unexpected error occurred: "https://registry.yarnpkg.com/get-caller-file: read ETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/Users/micheldiz/umover-fire/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
info There appears to be trouble with your network connection. Retrying...

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?

Please mention your node.js, yarn and operating system version.
yarn -v
1.3.2
node -v
v9.3.0

Mac Os High Sierra.

Details:

Arguments: 
  /usr/local/bin/node /usr/local/Cellar/yarn/1.3.2/libexec/bin/yarn.js add react-apollo

PATH: 
  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/bin/:/Users/micheldiz/Library/Android/sdk/tools:/Users/micheldiz/Library/Android/sdk/platform-tools:/usr/local/bin/:/Users/micheldiz/Library/Android/sdk/tools:/Users/micheldiz/Library/Android/sdk/platform-tools

Yarn version: 
  1.3.2

Node version: 
  9.3.0

Platform: 
  darwin x64

npm manifest: 
  {
    "main": "node_modules/expo/AppEntry.js",
    "private": true,
    "dependencies": {
      "expo": "^25.0.0",
      "react": "16.2.0",
      "react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz"
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  No lockfile

Trace: 
  Error: read ETIMEDOUT
      at _errnoException (util.js:999:13)
      at TLSWrap.onread (net.js:629:25)

@ghost ghost assigned torifat Jan 20, 2018
@ghost ghost added the triaged label Jan 20, 2018
@rooozox
Copy link

rooozox commented Jan 24, 2018

Got the same behaviour when I try to add a new module and the yarn.lock file exists.
I solve it by removing the yarn.lock file.
Then the yarn.lock file is being recreated (which is what I want)
And then I face again the same issue when I add a new module (yarn add ..) , remove yarn.lock and it works again.

@HarshulSharma000
Copy link

HarshulSharma000 commented Feb 9, 2018

Getting the same issue on
OS: Windows 10
Node: 9.4.0
Yarn: 1.4.0
npm: 4.6.1
Watchman: 4.9.1
Xcode: N/A
Android Studio: Version 3.0.0.0 AI-171.4443003
Packages are resolved but fetching is not happening, no lockfile generated, tried to edit network timeout also nothing happened. tried to move to earlier versions like 0.24.6 problem still persists.

@torifat
Copy link
Member

torifat commented Feb 12, 2018

@rooozox is it possible for you share your package.json and yarn.lock file?

@rooozox
Copy link

rooozox commented Feb 14, 2018

@torifat Sorry, I'm not able to replicate it anymore. I tried several times but now it works well. If it happens again I'll post back detailed infos.

@jarvis18
Copy link

jarvis18 commented Apr 5, 2018

I am having the same issue on Ubuntu 16.04

@KrisSiegel
Copy link

Interesting; on Ubuntu for Windows I've hard Yarn do this multiple times. npm install works fine and all other network connectivity works fine. To workaround I just ctrl + c and run yarn again. Almost always works.

Not sure what's going on and I haven't been able to create a small, reproducible project to share in an issue it's just something that happens sorta regularly for me with various projects.

@MichelDiz
Copy link
Author

MichelDiz commented Apr 9, 2018

I trying some "voodoos":

  • Delete any "*.lock" and rm node_modules. Or rm -rf node_modules/

  • Clean a flush all connections things like DNS, caches and so on.

  • Terminal commands:

  • set http_proxy=

  • set https_proxy=

  • yarn config delete proxy

  • npm config rm https-proxy

  • npm config rm proxy

  • npm config set registry "http://registry.npmjs.org" or npm config set registry "https://registry.npmjs.org"

  • Restart your terminal and Try.

  • Use : yarn add mypckge --network-timeout 100000 or yarn --network-timeout 100000
    but first try just yarn

  • Restart your terminal and Try yarn again and/or with --network-timeout.

For me is working for now. I'll see how will be over time.

@andrewnaeve
Copy link

andrewnaeve commented Apr 14, 2018

I am also experiencing this. Internet pulling down 70Mbps,

Timeout increase did not resolve, tried nuking docker containers, removing package.lock etc.

However, I got around this by tethering my phones LTE. wtf?

@Hinaser
Copy link

Hinaser commented May 15, 2018

I also have the same issue.

Environment
OS: Windows 10 x86_64
Node: v8.11.0
yarn: 1.5.1

Log

C:\Users\SomeUser\WebstormProjects\SomeProject>yarn add --dev nyc
yarn add v1.5.1
[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/nyc/-/nyc-11.7.3.tgz: ESOCKETTIMEDOUT".

Trying to isolate the issue
There are 3 suspects.

  • My windows PC's hardware (Network adapter maybe)
  • Client OS/Software issue
  • Remote npm server

I tried to issue the same yarn command on Virtual Ubuntu 16.04 running on my Windows PC by Hyper-V.
The result was successful. The virtual machine had no problem to install the new npm package.

At this time, I strongly suspect that the problem is in Windows 10 OS or yarn execution binary.

Looking deeper

I ran WireShark to monitor TCP packet between registry.yarnpkg.com and my windows PC,
and I found very interesting packets which might be the root cause.

Everytime the message There appears to be trouble with your network connection. Retrying...
is output on console, there is a RST packet sent from my PC to npm server.
You know, RST packet is to forcibly close TCP connection.
But it is sent from client PC.
I feel strange about this.

Next, I wondered what causes RST packet sent from my PC.
I found that every time before RST packet is sent, there are packets indicating TCP ZeroWindow, meaning data receiving entity (in this case it is my client PC) tells to a sender to stop sending packet until the receiver allow to do it.

After sender receives packets indicating TCP ZeroWindow, client must send TCP Window Update to server in order to resume TCP communication.

But I couldn't find those TCP Window Update packet sent from my client PC.
The npm server kept waiting to be allowed to send data but my client PC didn't tell to do so.
Then it is timed out and RST packet was sent from my PC.

Apparently, the root cause is not to send TCP Window Update packet to resume communication from client.
As I haven't had problem downloading large files from internet, I suspect the issue is in network code in node binary compiled for Windows.

@daisennomori
Copy link

Same issue here
--network-timeout 1000000 worked for me.

OS: Windows 10 1709 , WSL: Ubuntu 18
Node: 10.1.0
Yarn: 1.6.0

@Schlaefer
Copy link

Schlaefer commented May 20, 2018

OS: macOS 10.13.4
Node: 10.1.0
Yarn: 1.6.0

Same issue here. Connection timeouts and can't find packages on npm registry. Installing the same package via npm works fine.

Looking into the traffic as @Hinaser did I also see RST packages before the failure. The network is using a AVM FRITZ!Box 3272 router to connect to the Internet. Taking it out (connecting directly to the modem or using a different router) "fixes" the issues. Putting it back in and the errors are back.

edit: Router reset fixed it this time.

@129emma
Copy link

129emma commented May 22, 2018

I suddenly got the same issue, and couldn't use create-react-native-app to build new project.

Using package manager as yarnpkg with yarn interface.
Installing packages. This might take a couple minutes.
Installing react-native-scripts...
yarn
add v1.6.0
info No lockfile found.
[1/4] 🔍  Resolving packages...
info There appears to be trouble with your network connection. Retrying...

OS: macOS 10.13..4
Node: 8.11.1
Yarn: 1.6.0

@Glideh
Copy link

Glideh commented May 22, 2018

OS: Alpine (Docker node:9.4-alpine)
Node: 9.4.0
Yarn: 1.3.2

I'm now seeing at least these 4 other issues talking about this: #4333, #4890, #4510, #5447
Seems no obvious origin found yes.
Increasing the timeout also worked for me but not really a solution.

@raghudevan
Copy link

raghudevan commented May 22, 2018

Strange thing is I'm getting this error only when I do a yarn install from a docker container (node:carbon). If I run yarn install from my development terminal, all is fine 🤔

edit: it works on my local machine because of the yarn cache!

@rodrigobdz
Copy link

There appears to be some trouble with the npm servers right now.

@hopewise
Copy link

The same issue here..

@Glideh
Copy link

Glideh commented May 22, 2018

Interesting thing is from an other physical location (also different host both in the same country though) with the same docker image I don't get the error.
So maybe the npm servers have significant response time differences depending on the locations.

@NguyenHoangMinhkkkk
Copy link

suddenly i did it success. try again guys

@felix-weizman-deel
Copy link

The issue fixed now 🎆

@iJoyCode
Copy link

The issue fixed now 🎆

No, it's not :(
Image of Yaktocat

@cbodtorf
Copy link

Still having issues as well.

@rodrigobdz
Copy link

This time all systems are operational.
image

@knoxcard
Copy link

@MichelDiz - thanks a mil

@backspaces
Copy link

I just ran into this as well. Tried removing yarn's lockfile and node_modules/ Using npm install works fine. Also fails on CI which uses yarn for install and build.

Anyone have a hint on how to proceed? I could do a fresh clone etc but this seems really odd.

master: yarn
yarn install v1.6.0
info No lockfile found.
[1/4] 🔍 Resolving packages...
info There appears to be trouble with your network connection. Retrying...
error Received malformed response from registry for undefined. The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

@backspaces
Copy link

@MichelDiz .. that seems to work, thanks. Do we know what is happening?

@knoxcard
Copy link

knoxcard commented May 26, 2018

@backspaces - "You can CNAME across CloudFlare accounts but you can’t CNAME a proxied record to another proxied record." - this is what I've been told

@sergey-shpak
Copy link

sergey-shpak commented Oct 28, 2020

after about 2 hours and trying all the solutions, finally this worked for me:
npm config set registry "http://registry.npmjs.org"
and then:
yarn config set registry "http://registry.npmjs.org"

@xccjk
Copy link

xccjk commented Nov 20, 2020

The same problem exists on my machine.
OS: macOS 10.14.6
Node: 14.15.0
NPM: 6.14.8
Yarn: 1.22.10

In some networks, the initialization project is very slow, and the network reason is always prompted, but the installation is successful, and it took about 10 minutes

After turning on the circumvention network, it is still as smooth as before

Do you know the reason?

@Hazmi35
Copy link

Hazmi35 commented Nov 20, 2020

I have the same problem, but only when I'm building multi-platform Docker images with buildx, when I first received this problem, I think it's only a network issue from my home network, but it's actually not, it's also affecting my docker/build-push-action in https://github.com/Hazmi35/jukebox too, strangely it's not affecting the AMD64 platform as you can see in https://github.com/Hazmi35/jukebox/runs/1430274704?check_suite_focus=false, AMD64 only takes 74.1 seconds, which itself is quite slow, but ARM platforms (ARM64, ARMv7, and ARMv6) can take up to 1136.06 seconds. Any tips? I've using network-timeout 600000 to prevent the build from failing. But now it's very slow

@merceyz
Copy link
Member

merceyz commented Jan 2, 2021

Closing as fixed in v2 where the timeout logic is less susceptible to this sort of issue

https://yarnpkg.com/getting-started/migration

@merceyz merceyz closed this as completed Jan 2, 2021
@merceyz merceyz added the fixed-in-modern This issue has been fixed / implemented in Yarn 2+. label Jan 2, 2021
@aprilmintacpineda
Copy link

aprilmintacpineda commented Mar 18, 2021

I'm having the same problem when running yarn add or yarn global add on Github actions. It's intermittent. Sometimes it recovers, sometimes it fails.

@sibelius
Copy link

@Hazmi35 did you figure it out how to improve yarn install times when building ARM?

@sibelius
Copy link

related issue nodejs/docker-node#1335

@Hazmi35
Copy link

Hazmi35 commented Mar 20, 2021

@Hazmi35 did you figure it out how to improve yarn install times when building ARM?

@sibelius Sadly no, I moved to npm when I tried Yarn 2 on that project and it seems to be incompatible. Although, before that, I don't see any issues about the slow download other than the compile-time for native modules is slow in emulated build, and it's also happening with npm.

@ivolucien
Copy link

ivolucien commented Feb 15, 2022

Yet another way this issue can occur, if you have a split dns setup with a vpn, the default dns server needs to resolve the npm registry. For my setup this worked:

sudo resolvectl default-route [your-vpn-device-name] true && sudo resolvectl default-route [your-internet-device-name] false

@sunny-to
Copy link

I was running into this in a Docker container. I think it was actually a disk space issue and not a networking issue, as deleting all my unused Docker images fixed the issue for me.

@ranjithrd
Copy link

If someone is still facing this issue with scoped packages (@types/react for example), please refer to #8797
It can be fixed by using node version v17.7.1

@odahcam
Copy link

odahcam commented Jun 29, 2022

After trying everything I could, today the problem just stopped happening. 😵‍💫

@natesdot
Copy link

I have been troubleshooting this issue myself for several hours now, and my situation is different from all others that I have seen but the same error persists. Wondering if anyone could shed some light on the situation.

I get this error only running inside of docker, if I run the same commands on the host it works fine(100% of the time). The connections are very fast, installing packages takes just a few seconds in both cases. So there is no timeout situation(but have tried messing with that option). Running wget/curl against the "failed" urls results in success 100% of the time.

However yarn continues to report sporadic "trouble" when running inside of docker.
I made a small breakthrough a short time ago, found that running docker with --network host allows the commands to run without errors. So I am assuming it has something to do with the docker iptables rules in my case? I'm no iptables expert or even at this point I wouldn't even consider myself a novice it's probably been 10+ years since I last touched iptables. The problem happens on all hosts, using the default docker setup/rules. So I can't imagine it would be related to iptables, but what else could it be if --network host resolves the issue for me? I don't know..

@natesdot
Copy link

I have been troubleshooting this issue myself for several hours now, and my situation is different from all others that I have seen but the same error persists. Wondering if anyone could shed some light on the situation.

Mostly pure luck I suppose, but I managed to fix my issue by setting these sysctl flags

  • net.core.wmem_max=12582912 (default was 212992)
  • net.core.rmem_max=12582912 (default was 212992)

I never thought I'd need to adjust a kernel setting like this for an otherwise completely idle system running just one container and this yarn program accessing a few urls. Can't say I've touched these parameters much at all in my 26ish years of using Linux.

@Juanc1to
Copy link

Juanc1to commented Apr 5, 2023

After poking at many of the proxy, cache, and timeout settings that others have suggested, I also rebooted my router and that immediately fixed the problem. It is certainly curious to me that the router can get into a state where these yarn network requests time out, but all other "normal" internet traffic functions properly. I would be very interested in learning more about what might cause the router to get into such a state!

@IshanKute
Copy link

I am also experiencing this. Internet pulling down 70Mbps,

Timeout increase did not resolve, tried nuking docker containers, removing package.lock etc.

However, I got around this by tethering my phones LTE. wtf?

Thank you so much. Weird but this is the only thing that worked for me.

@Rafael3326
Copy link

Rafael3326 commented Aug 9, 2023

After poking at many of the proxy, cache, and timeout settings that others have suggested, I also rebooted my router and that immediately fixed the problem. It is certainly curious to me that the router can get into a state where these yarn network requests time out, but all other "normal" internet traffic functions properly. I would be very interested in learning more about what might cause the router to get into such a state!

isso resolveu meu problema, eu te amo seu gringo lindooo <3 <3

@jahammo2
Copy link

jahammo2 commented Oct 1, 2023

For anyone still running into this issue, the fix for me was to connect to a different WiFi connection.

None of the other tricks (adding --timeout, yarn cache clean, npm config rm proxy, etc) worked but changing my WiFi connection did 🤷‍♂️ .

@CalebFenton
Copy link

My problem was that my docker daemon didn't have ipv6 tables enabled. I had ipv6 enabled but not the tables. https://docs.docker.com/config/daemon/ipv6/

I diagnosed this by running the docker container's /bin/ash and checking network stuff. I could ping my router, ping my DNS, and resolve domains to IPs, but I couldn't ping google because that went to an ipv6 address. After fixing the daemon config and restarting the service, everything worked fine.

@callmebar
Copy link

In my case, I've gotten ETIMEDOUT immediately after yarn install no matter how huge was --network-timeout. I was monitoring packets through WireShark and noticed that in TCP handshake my side sends RST after getting SYN,ACK from yarnpkg server. Digging deeper, I found the reason.

node:net has a parameter autoSelectFamilyAttemptTimeoutDefault be default it is 250ms, that is not enough for my slow internet connection. This parameter at the current version if node (v21.7.1) can not be changed by NODE_OPTIONS, only from code, so all the libraries that use node.net must adjust this parameter, but they do not.

So it is not really yarn problem, but it can be fixed on the yarn level by, for example, running net.setDefaultAutoSelectFamilyAttemptTimeout(networkTimeout) in utils/request_manager:setOptions.

However, since I can't fix all libraries that ignore this parameter, I manually patched this line in node and built it from source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+. triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.