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

Yarn Dependency Issue on Windows - Takes Forever #5144

Open
thecjharries opened this issue Jan 2, 2018 · 12 comments
Open

Yarn Dependency Issue on Windows - Takes Forever #5144

thecjharries opened this issue Jan 2, 2018 · 12 comments
Assignees
Labels

Comments

@thecjharries
Copy link

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

This is a bug, I think. #990 and #3234 seem to suggest I should make a new issue.

There's a pretty good chance I've missed some simple fixes. I'm hoping that's the case.

What is the current behavior?

When installing, yarn add grabs everything and always links everything. I've built a repo to duplicate the issue. For example,

$ cd npm-small
$ npm install moment
added 1 package in 2.863s
$ npm install fs-extra
added 4 packages in 1.351s
$ cd yarn-small
$ yarn add --cache-folder=../yarn-cache moment
Done in 2.82s.
$ yarn add --cache-folder=../yarn-cache fs-extra
Done in 2.03s.
$ cd npm-large
$ npm install @angular/cli
added 994 packages in 142.135s
$ npm install fs-extra
added 116 packages and updated 1 package in 18.505s
$ cd yarn-large
$ yarn add --cache-folder=../yarn-cache @angular/cli
Done in 207.14s.
$ yarn add --cache-folder=../yarn-cache fs-extra
Done in 105.35s.

What is the expected behavior?

Not that?

Please mention your node.js, yarn and operating system version.

From my repo:

bash:

$ yarn -v
1.3.2
$ node -v
v8.9.3
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial
$ asciinema --version
asciinema 1.4.0

PowerShell:

> conemu-cyg-64.exe --version
ConEmu cygwin/msys connector version 1.2.2
> wslbridge.exe --version
wslbridge 0.2.3
> Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object ProductName, CurrentMajorVersionNumber, CurrentMinorVersionNumber, ReleaseId, CurrentBuild, CurrentBuildNumber, BuildLabEx


ProductName               : Windows 10 Pro Insider Preview
CurrentMajorVersionNumber : 10
CurrentMinorVersionNumber : 0
ReleaseId                 : 1709
CurrentBuild              : 17025
CurrentBuildNumber        : 17025
BuildLabEx                : 17025.1000.amd64fre.rs_prerelease.171020-1626
@ghost ghost assigned BYK Jan 2, 2018
@ghost ghost added the triaged label Jan 2, 2018
@bestander
Copy link
Member

bestander commented Jan 3, 2018

@thecjharries, thanks for raising this.
Yarn add command may take roughly the same time as a fresh install command that is because yarn may rebuild the node_modules structure when changing dependencies.

Still 207.14s for @angular/cli vs npm's 142.135s is a good data point.

As a general suggestion to see if Windows Defender is interfering with install, open Task Manager during install and see if Windows Defender or Indexing Service is getting high CPU usage.

Raising attention to @BYK regarding performance.

@thecjharries
Copy link
Author

I was able to solve my issue by moving to a better operating system. However, I doubt everyone will have that luxury.

Thanks for the response, @bestander! So Yarn has to rebuild node_modules each time a package is added? Is that, in combination with Windows Defender, responsible for the ~100s install time for the second package?

@bestander
Copy link
Member

So Yarn has to rebuild node_modules each time a package is added

In the worst case scenario, yes.
In most cases it should not be a problem because packages in node_modules don't usually get rearranged if you add a dependency.
However Yarn would run through all node_modules and check if something might have corrupted the files, so expect a bunch of io read operations.

Is that, in combination with Windows Defender, responsible for the ~100s install time for the second package?

I suppose when Yarn checks that all other files in node_modules are not modified it does a bunch of IO reads that Windows Defender might find suspicious and passes it through an antivirus.

Good that you found a solution

@cryptoquick
Copy link

I'm actually using yarn in the ubuntu environment on windows, and I'd like to see this fixed, as I'm planning to use this setup for the foreseeable future.

@justjoeyuk
Copy link

Is there any update on this? I'm using Linux Subsystem on Windows and it takes about 5-10 mins to remove and then add a dependency.

@daniel08s
Copy link

Same here, around 5 minutes to add a package.

Linux Subsystem for Windows 10

➜  yarn -v
1.5.1

➜  node -v
v9.4.0

➜  npm -v
5.8.0

➜  lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial

Using the --verbose flag with yarn add I'm seeing that it is taking most of the time copying the files from the cache to node_modules.

@BYK
Copy link
Member

BYK commented May 3, 2018

@iSkilled can you share your package.json and yarn.lock files?

@daniel08s
Copy link

Sure.
package.json
yarn.lock

@mnpenner
Copy link

To be clear... this issue affects WSL/Bash, correct? Because that's what I'm experiencing now. Not sure if cmd.exe performs any better.

@SimpleCookie
Copy link

Any update on this?

@segux
Copy link

segux commented Feb 17, 2019

Im stucked with this problem too. Trying to make yarn install and sometimes getting
error An unexpected error occurred: "ENOENT: no such file or directory, copyfile
Related to .cache/yarn/v4 and WSL Ubuntu.

My yarn version is 1.13.0

@httpete
Copy link

httpete commented May 1, 2019

Add these exclusions to your defender in control panel.
Go to Windows Security / Virus and Threat protection, Virus and Threat Protection Settings, then choose Exclusions.

Add these two folders.

The Node.js folder is located at: c:\Program Files\nodejs and lastly the yarn global folder is at: c:\Users\YourUserName\AppData\Local\Yarn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants