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

Created on 20 Jan 2018  ·  80Comments  ·  Source: yarnpkg/yarn

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)

triaged

Most helpful comment

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.

All 80 comments

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.

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.

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

@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.

I am having the same issue on Ubuntu 16.04

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.

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.

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?

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.

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

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

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.

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

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.

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!

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

The same issue here..

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.

suddenly i did it success. try again guys

The issue fixed now 🎆

The issue fixed now 🎆

No, it's not :(
Image of Yaktocat

Still having issues as well.

@MichelDiz - thanks a mil

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.

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

@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

Actually, turns out there really IS a problem:
snap 05 25 18-18 17 54

@MichelDiz Thank you. Everybody's a magician

@MichelDiz I tried yarn --network-timeout 100000 install, and it worked. Full Dockerfile can be found at https://github.com/vietnam-devs/coolstore-microservices/blob/master/src/web/Dockerfile

same issue in mac
mac: 10.13.5 (17F77)
yarn version: 1.7.0
node version: 10.4.0

yarn add pugpug-loader --dev
yarn add v1.7.0
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "http://r.cnpmjs.org/streamqueue/download/streamqueue-0.0.6.tgz: readETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/Users/xxx/xxx/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

For _some_ reason yarn would not install the package that I needed. In this case compression. I am using a windows 10 pro system with docker containers. What I did was instead of using yarn install in my Dockerfile was change to npm install. It worked like a charm. #backinbusiness

Same problem here using

λ create-react-app .

Creating a new React app in C:\Users\Pawel\WebstormProjects\testproject.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.7.0
info No lockfile found.
[1/4] Resolving packages...
warning react-scripts > jest > jest-cli > istanbul-api > [email protected]: 1.2.0 should have been a major version bump
[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: "http://registry.npmjs.org/compression/-/compression-1.7.2.tgz: socket hang up".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\Pawel\\WebstormProjects\\testproject\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts --cwd C:\Users\Pawel\WebstormProjects\testproject has failed.

Deleting generated file... package.json
Deleting generated file... yarn-error.log
Deleting testproject / from C:\Users\Pawel\WebstormProjects
Done.

On Win10Pro.

npx create-react-app testproject --use-npm worked like a charm

I rebooted my terminal and it worked.

I have currently this problem, but only with the package postcss-sprites. All other packages were fine.

I ran the yarn upgrade command on version 1.7.0 and everything was done successfully.

After that, I updated the package to version 1.9.4 and nodejs to 10.8.0 version (from 10.7.0), and tried to start the command again. Now the packages are not updated, but in the console I see:
info There appears to be trouble with your network connection. Retrying...

Next, I deleted yarn.lock file and run yarn install command:

$ yarn install
yarn install v1.9.4
info No lockfile found.
[1/4] Resolving packages...
warning laravel-mix > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning laravel-mix > css-loader > cssnano > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning laravel-mix > css-loader > cssnano > postcss-merge-rules > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning laravel-mix > css-loader > cssnano > postcss-merge-rules > caniuse-api > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning laravel-mix > img-loader > imagemin-mozjpeg > mozjpeg > bin-build > download > gulp-decompress > [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
[2/4] Fetching packages...
[-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0/1259(

node:15992) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
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...

(yarn 1.9.4, nodejs 10.8.0)

And run yarn install --verbose command withoutput:

node:9952) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
verbose 27.147 Performing "GET" request to "https://registry.yarnpkg.com/material-design-icons/-/material-design-icons-3.0.1.tgz".
info There appears to be trouble with your network connection. Retrying...
verbose 121.206 Performing "GET" request to "https://registry.yarnpkg.com/material-design-icons/-/material-design-icons-3.0.1.tgz".
info There appears to be trouble with your network connection. Retrying...
verbose 196.627 Performing "GET" request to "https://registry.yarnpkg.com/material-design-icons/-/material-design-icons-3.0.1.tgz".

In this case, if you open a link to a file in the browser, the file is successfully downloaded.

2018-08-06 10-13-39 - google chrome

Next, downgrade nodejs to 10.7.0 version and see too error message :(

Deleting the folder node_modules did not solve the problem. And next step - I downgraded yarn to 1.9.2 RC version and the installation process was fine.

@Hinaser Thanks! For some reason i totally forgot i had Malawarebytes (antivirus program) running, and your comment made me remember to shut it off, fixed my "There appears to be trouble with your network connection" problem.

Having this issue right now on an Ubuntu 16.04 running node 8. I was able to download and install 1,500+ packages, but it stalls on this one.

[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/react-icons/-/react-icons-2.2.7.tgz: ESOCKETTIMEDOUT".

None of the above hints have helped. And npm is reporting all systems are fine.... :(

Based on what I'm reading above, the fact that it is this package that is stalling is probably somewhat random. I can reach the package from the ubuntu machine via curl with no problem, so it's not a genuine networking issue.

$ curl -I https://registry.yarnpkg.com/react-icons/-/react-icons-2.2.7.tgz
HTTP/1.1 200 OK
Date: Thu, 30 Aug 2018 03:23:06 GMT
Content-Type: application/octet-stream
Content-Length: 1097331

@apotek

Try...

yarn remove react-icons
yarn upgrade
yarn add react-icons

See #6317 issue:

@OneCyrus
it looks like increasing the network timeout helps.
yarn --network-timeout 80000

It's works!

Try...

yarn remove react-icons
yarn upgrade
yarn add react-icons

@knoxcard
Thank you for your help. Unfortunately, this did not work. Removing react-icons failed since I have never had a successful yarn install on my CI server (due to the above issue). So there was nothing to remove.

When running yarn add react-icons, I continued getting the same timeout.

Running yarn add react-icons@knoxcard however, then everything worked beautifully :). Choosing version version 3.0.5 (latest) didn't work either. Same issue.

@andrey-helldar thank you as well, but unfortunately yarn --network-timeout 100000 didn't work either. I had already tried most of the magic here https://github.com/yarnpkg/yarn/issues/4890 and https://github.com/yarnpkg/yarn/issues/5259#issuecomment-379769451

💣

maybe time to go back to npm 😬

I have same problem last night

Using yarn --network-timeout 100000 didn't work for me.
Then I remember if I use DNS from Google, I try to delete the DNS and then voila yarn can be used as before

I don't know if this is indeed from the DNS that I use, but for the time being it solves my problem

It appears i did not have any connection issues, but i connected to other wifi network and retried, and then was able to run yarn create react-app appname and get the expected behavior of creating a new react app

For me, this was because I had added two factor auth to my npmjs.org account.

I ran:

npm logout
npm login

Then filled out the details, including the MFA OTP request. Then everything worked again.

Got tired of retrying creating Docker images due to yarn install having intermittent network problems. Turns out it was pretty easy to fix by automating retrying from inside the Dockerfile =)

# HACK: get around intermittent network problems downloading packages.
RUN for attempt in $(seq 1 100); do yarn install --frozen-lockfile && break; done

More verbose, in case you want to _see_ some progress.

# HACK: get around intermittent network problems downloading packages.
RUN for attempt in $(seq 1 100); do echo "Attempt number $attempt"; yarn install --verbose --frozen-lockfile && break; done

You might want to change/add flags to yarn install depending on your situation; see for example https://github.com/yarnpkg/yarn/issues/749.

I rebooted my terminal and it worked.

This fixed the issue for me.

Solution for me in MacOS High Sierra,
Change the DNS to
1.1.1.1
8.8.8.8
8.8.4.4
Off and On the wifi or network connection and
Yeah works.

Hi, i am facing same issue

tried most of the options but none of them are working

sudo yarn global add gulp-cli --network-timeout 100000
[sudo] password for prasad: 
yarn global v1.10.1
[1/4] Resolving 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/gulp-cli: getaddrinfo ENOTFOUND registry.yarnpkg.com registry.yarnpkg.com:443".
info If you think this is a bug, please open a bug report with the information provided in "/usr/local/share/.config/yarn/global/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

Upgrading my nodejs to the latest version worked for me.

Had the same issue, using google DNS and turning wifi off & on fixed it for me, no more timeout.

Upgrading my nodejs to the latest version worked for me.
Hi @saeedahmadee
Has this fix worked for you so far?

@MichelDiz I tried yarn --network-timeout 100000 install, and it worked. Full Dockerfile can be found at https://github.com/vietnam-devs/coolstore-microservices/blob/master/src/web/Dockerfile

This worked for me

Node version 8.1
Yarn version 1.12.3

  • Delete all "locks" and rm node_modules. rm -rf node_modules/

This worked for me in addition to removing yarn.lock

Thanks!

I'm getting this only inside a Docker container and only within arm32v6 builds. Tried all the suggestions/solutions and nothing has worked for me.

EDIT: For me, I was able to identify the issue with a slow performing qemu version. Updated qemu and all worked well.

Same. WTF

Same, only inside Docker.

I trying some "voodoos":

  • Delete all "locks" and rm node_modules. 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.

it worked for me!

I was with problem when tried "yarn" and also "npm install", it was stuck in fetching package and loadalldepsintoidealtree.

Resolved for me by simply deleting package-lock.json. Thanks, @MichelDiz.

At home it works fine, but at work on vpn total garbage, constant timeouts.
So tried this: yarn --network-timeout 100000 and it still failed a few times, BUT
SUCCESS after forever, finally got past step [2/4]....YEAHHHHHHHHH!!!!!!!!!

npx: installed 63 in 30.591s

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.13.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...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > pnp-webpack-plugin > [email protected]" has unmet peer dependency "typescript@*".
[##########--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 1111/23233

None of the solutions were working for me. So I tried restarting my computer and it worked 🤦‍♂️

in my case i removed the package.json.lock file in my root folder and where i want to create a new react app worked!!

If you have ip6-only network and the error occurs, you can try to workaround with adding

2606:4700::6810:1723 registry.yarnpkg.com
2606:4700::6810:1723 registry.npmjs.org
2606:4700::6810:ab63 yarnpkg.com

to /etc/hosts. You can get the ip6 with nslookup registry.yarnpkg.com. https://github.com/yarnpkg/yarn/issues/6031

The problem remains, Windows Server 2019 Datacenter running in AWS
I doubt the AWS network is having issues as this happened over multiple days.
It is either something fishy with your binary, the registry or some Windows service doing something fishy with the traffic and most likely one of the earlier two.

The underlying problem in our case turned out to be nodejs 10.15.0 and upgrading to later node (10.16.3) version resolved the issue.

Hi guys!

I was facing same issue with .local address on Ubuntu and I fixed with this:

_sudo gedit /etc/nsswitch.conf_

then I change this lines on that file:

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

to

hosts: files dns mdns4_minimal [NOTFOUND=return] mdns4

If the yarn.lock was generated while yarn was pointed at an alternate registry (via an .npmrc file, npm config, or --registry), then it will try to resolve the package from the same source. Before you delete your yarn.lock, you can check if that is what is causing your problem with something like:
cat yarn.lock |grep resolved| grep -v 'registry.yarnpkg.com'

You may want to try uninstall and reinstall it.

I actually tried a lot of stuffs...

npm version: 6.12.1
node version: 12.13.1
windows 10 x64
trying to install expo-cli 3.9.1

  1. update npm/yarn to latest
  2. update node to latest
  3. clear npm registry
  4. clear npm/yarn cache
  5. delete node_modules and yarn.lock
  6. restart my laptop/cmd/cmder
  7. npm uninstall expo-cli then reinstall it

It works after 7th step.

Original analysis by @Hinaser

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.

After separately running into this issue, and doing my own packet analysis, this reflects what I’m seeing. The other thing that seems strange is, applications like cURL have no issue with this, and are able to keep up with the server. Is there any way to have yarn buffer the file to reduce the amount of work it needs to do? This issue is also present with npm, so I’m really not sure what to do here

I've found my yarn keeps trying to connect to
verbose 0.349 Performing "GET" request to "https://yarnpkg.com/latest-version".

The host is unreachable as I am using a proxy and I have a local registry. Any way to disable this check?

None of the solutions were working for me. So I tried restarting my computer and it worked

I also updated my Docker for Mac program and then restarted the system, after that the problem is gone so far.

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)

Might be a little late but, this method of debugging worked for me!

first check your yarn's configs list -> $ yarn config list

Then check for proxy's that might be set. usually https-proxy or proxy

Ex:

gaganganapathyas:Transcriptor codhek$ yarn config list
yarn config v1.21.1
info yarn config
{
  'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-commit-hooks': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '^',
  'bin-links': true,
  'ignore-scripts': false,
  'ignore-optional': false,
  registry: 'https://registry.yarnpkg.com',
  'strict-ssl': true,
  'user-agent': 'yarn/1.21.1 npm/? node/v13.6.0 darwin x64',
  'https-proxy': 'http://172.31.2.4:8080',   [ THIS ONE HERE HAD TO BE DELETED ]
  lastUpdateCheck: 1549658796393
}
info npm config
{
  '//registry.npmjs.org/:_authToken': 'd976d660-cf65-4d3e-9e3c-e05c2beef418',
  python: '/usr/bin/python'
}
✨  Done in 0.07s.

So just delete using $ yarn config delete https-proxy

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.

Thanks!

In my case, I downloaded react via yarn once at work, it has its own corporate npm registry. Yarn apparently set the "source" for react to corporate npm registry. Now, at home, I can't/don't want to connect to corporate VPN, I come to a clean folder, try to create-react-app, npx create-react-app zzz and instead of going to real npm, yarn is looking for react in yesterday's corporate npm registry. Naturally it doesn't work.

Suggestion to yarn maintainers:

If yarn fails, error with message "There appears to be trouble with your network connection", add an additional check, maybe official npm registry is not being queried, and if so, try official npm registry instead.

This is very important. It's not internet down, it's wrong registry.

Personally, I think that's one of the examples how competition between yarn and npm makes users suffer, maybe there should be only one package manager...

I do believe that my issue was different than any of the ones discussed here so I am going to comment. Doing a yarn install gave me the dreaded "There appears to be trouble with your network connection" issue and the "voodoo" above did nothing for me. A co-worker helped(thanks Steve) and doing a printenv | grep proxy showed that I had values set to 127.0.0.1:8888 but I do not know where it magically came from. I just did unset http_proxy and unset https_proxy Success!!

I have a feeling that it's not the network at all. It's a function on the number of files and/or the size. The packages I ran always into this issue has a lot of files (material-ui icons). I suspect the tgz processing (either packing on the server or unpacking on the client) is the culprit but it is reported as a "networking" issue when it is not.

icons-3.0.1.tgz ~684kb -> representing ~16MB for 10k files

Also the following was reported:
nyc-11.7.3.tar ~3.4M representing ~18 MB for 4.7K files

What should we do when we are using Lerna and yarn as its installer?

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.

After two hours of finding solution, come your answer thanks!

same issues on win10 with yarn . The "voodoos" work partially , able to run only yarn . yarn boostrap or yarn clean && yarn bootstrap don t work :(

I was struggling with this since June this year. I finally got it to work... Here is what I did:

  1. This will show you your current config
    yarn config list

  2. I then set my registry to use the "HTTP" (NOTE: NOT the HTTPS!!!)
    yarn config set registry "http://registry.npmjs.org"

  3. For good measure, I did the same for npm:
    npm config set registry "http://registry.npmjs.org"

  4. I changed my .vimrc to do as follows:
    Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile --network-timeout 1000000'}

  5. You you can also cd to: ${HOME}/.local/share/nvim/plugins/coc.nvim (if you are on VIM, then go to ~/.vim and search for coc.nvim to see where it is installed with "cd ~/.vim && find . -name coc.nvim -type d"). Then run:
    yarn install --frozen-lockfile --network-timeout 1000000

This finally worked for me.... And I kinda know what the issue is. I noticed that my machine sends a RST same issue some people have raised here, which just makes it not work. By switching to HTTP somehow I am bypassing whatever issues are there on this machine/network.

Just posting this here in case others have the same problem.

The two things that I've seen that fix this (for 2 different computers) are:

  • create a new file, /etc/docker/daemon.json containing { "mtu": 1380 } to fix a docker network to local network incompatibility, use ip addr or similar to check your network interface mtu, set the daemon.json setting to a little below that (and restart the docker service)

  • add an option to the yarn install line, --network-timeout 600000 (10 minutes) in case your access to the registry is lagging badly

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"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ocolot picture ocolot  ·  3Comments

baptistelebail picture baptistelebail  ·  3Comments

sebmck picture sebmck  ·  3Comments

MunifTanjim picture MunifTanjim  ·  3Comments

jviotti picture jviotti  ·  3Comments