# Yarn network troubles

**URL:** <https://travis-ci.community/t/yarn-network-troubles/333>\
**Category:** Windows\
**Created:** [October 13, 2018, 1:13pm UTC](https://travis-ci.community/t/yarn-network-troubles/333 "2018-10-13T13:13:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![xPaw](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/xpaw/32/148_2.png) [@xPaw](https://travis-ci.community/u/xPaw)\
**Post date:** [October 13, 2018, 1:13pm UTC](https://travis-ci.community/t/yarn-network-troubles/333/1 "2018-10-13T13:13:53Z")

</div>

It seems that the build always runs into network problems when installing yarn dependencies only on Windows.

[3/5] 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…

[https://travis-ci.org/thelounge/thelounge/jobs/440995140#L79](https://travis-ci.org/thelounge/thelounge/jobs/440995140#L79)

---

<div class="post-metadata">

**Author:** ![josh](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/josh/32/12_2.png) [@josh](https://travis-ci.community/u/josh)\
**Post date:** [October 13, 2018, 2:53pm UTC](https://travis-ci.community/t/yarn-network-troubles/333/2 "2018-10-13T14:53:17Z")

</div>

Interesting. Could you try increasing the network timeout?

In your `.travis.yml`:

```auto
before_install: yarn install --network-timeout 1000000

```

> <https://github.com/yarnpkg/yarn/issues/4890#issuecomment-358179301>

---

<div class="post-metadata">

**Author:** ![xPaw](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/xpaw/32/148_2.png) [@xPaw](https://travis-ci.community/u/xPaw)\
**Post date:** [October 13, 2018, 3:54pm UTC](https://travis-ci.community/t/yarn-network-troubles/333/3 "2018-10-13T15:54:40Z")

</div>

That removed the info message, however the install is still pretty slow. It takes multiple minutes to install dependencies (the project certainly doesn’t have THAT many dependencies, and it’s quite a bit faster on my local machine with home internet speeds)

---

<div class="post-metadata">

**Author:** ![xPaw](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/xpaw/32/148_2.png) [@xPaw](https://travis-ci.community/u/xPaw)\
**Post date:** [October 13, 2018, 4:06pm UTC](https://travis-ci.community/t/yarn-network-troubles/333/4 "2018-10-13T16:06:56Z")

</div>

And to clarify, I disabled `cache: yarn`, and installing on linux takes 20 seconds compared to minutes on Windows.

Build: [https://travis-ci.org/thelounge/thelounge/builds/441035440](https://travis-ci.org/thelounge/thelounge/builds/441035440)

---

<div class="post-metadata">

**Author:** ![josh](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/josh/32/12_2.png) [@josh](https://travis-ci.community/u/josh)\
**Post date:** [October 13, 2018, 6:15pm UTC](https://travis-ci.community/t/yarn-network-troubles/333/5 "2018-10-13T18:15:24Z")

</div>

Thanks for the info. The Windows filesystem seems to be a bit slower, although we still have lots of tuning and improving yet to do. Caching is disable for all windows builds for the time being while we update some of our code to work with Windows. We hope to have it available next week.

For the time being I would class the initial issue as resolved, although we should document this, or apply the yarn timeout ourselves so others don’t need to.

Thank you for this feedback!

---

<div class="post-metadata">

**Author:** ![xPaw](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/xpaw/32/148_2.png) [@xPaw](https://travis-ci.community/u/xPaw)\
**Post date:** [January 23, 2019, 6:41pm UTC](https://travis-ci.community/t/yarn-network-troubles/333/6 "2019-01-23T18:41:29Z")

</div>

I don’t consider this issue solved, if anything it got worse.

Here’s latest build: [https://travis-ci.com/thelounge/thelounge/builds/98297848](https://travis-ci.com/thelounge/thelounge/builds/98297848)

1 minute for Linux, 14 minutes for Windows. Almost 8 minutes of which are spent in Yarn.

Windows file system is slower, but it’s not that slow.

---

<div class="post-metadata">

**Author:** ![bompi88](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/bompi88/32/561_2.png) [@bompi88](https://travis-ci.community/u/bompi88)\
**Post date:** [March 10, 2019, 3:39pm UTC](https://travis-ci.community/t/yarn-network-troubles/333/7 "2019-03-10T15:39:07Z")

</div>

Disabling Windows Defender Realtime Monitoring boosts my yarn install from 900s to 180s. And I don’t get any network related issues.

```
export NODEPATH=$(where.exe node.exe)
export PROJECTDIR=$(pwd)
export YARNCACHE=$(yarn cache dir)
export TEMPDIR=$LOCALAPPDATA\\Temp

powershell Add-MpPreference -ExclusionProcess ${NODEPATH}
powershell Add-MpPreference -ExclusionPath ${YARNCACHE}
powershell Add-MpPreference -ExclusionPath ${PROJECTDIR}
powershell Add-MpPreference -ExclusionPath ${TEMPDIR}

echo "DisableArchiveScanning..."
powershell Start-Process -PassThru -Wait PowerShell -ArgumentList "'-Command Set-MpPreference -DisableArchiveScanning \$true'"

echo "DisableBehaviorMonitoring..."
powershell Start-Process -PassThru -Wait PowerShell -ArgumentList "'-Command Set-MpPreference -DisableBehaviorMonitoring \$true'"

echo "DisableRealtimeMonitoring..."
powershell Start-Process -PassThru -Wait PowerShell -ArgumentList "'-Command Set-MpPreference -DisableRealtimeMonitoring \$true'"
```

---

<div class="post-metadata">

**Author:** ![tanzislam](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/tanzislam/32/2591_2.png) [@tanzislam](https://travis-ci.community/u/tanzislam)\
**Post date:** [August 28, 2019, 6:42pm UTC](https://travis-ci.community/t/yarn-network-troubles/333/8 "2019-08-28T18:42:08Z")

</div>

I can confirm, [disabling Windows Defender](https://travis-ci.org/tanzislam/cryptopals/builds/577988095/config) actually allowed my Windows job to complete well within the 50-minute limit. Everything from casher to MSYS2 installation to `git submodule update --recursive` on Boost was super-fast.
