yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Linking dependencies is taking a long time

Open sfabriece opened this issue 10 years ago • 74 comments

Do you want to request a feature or report a bug? bug What is the current behavior? when installing a dependency, the third step: linking dependencies is taking a long time, even for a single package 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. node: 6.7.0 OS: Windows 10

sfabriece avatar Oct 27 '16 01:10 sfabriece

I'm having linking dependancies take 200+ seconds with this https://github.com/macdja38/pvpsite/blob/master/package.json on Windows 10, off an SSD with a decent i7.

macdja38 avatar Oct 27 '16 11:10 macdja38

It seems the performance issue may be caused by windows Defender, disabling it while possibly inadvisable reduced 200s to somewhere closer to 50.

macdja38 avatar Oct 27 '16 11:10 macdja38

I think that there should be a better solution than reducing security.

sfabriece avatar Oct 27 '16 12:10 sfabriece

Some other users have confirmed that disabling it just in the root directory of your project works, but I can't confirm as Windows Defender broke itself a bit when I tried to do that.

macdja38 avatar Oct 28 '16 02:10 macdja38

I've got the same with issue with git repo with about 30 dependencies. Windows 10 node v5.5.0 yarn 0.16.1

image

image

Disabling Windows Defender reduced linking time significantly

image

wclr avatar Nov 06 '16 14:11 wclr

Probably should be "solved" by this PR?

wclr avatar Nov 07 '16 19:11 wclr

Yeah there's not a lot we can do here unfortunately :( Virus scanners scan all files, and the npm ecosystem has a lot of small files. Small files generally have a bit more overhead on NTFS compared to other file systems such as EXT4 or ZFS, but it's exacerbated by virus scanners.

Having said that, Yarn should still be faster than npm, it just won't be as fast as on Linux or Mac.

Daniel15 avatar Nov 08 '16 01:11 Daniel15

I am on a Mac without having any antivirus scanners installed. But I still see the same problem, linking taking considerable amount of time even with a simple angular-js app.

sharat avatar Nov 28 '16 09:11 sharat

I have this issue too. It took 174s on Ubuntu.

bjackson avatar Nov 28 '16 23:11 bjackson

I started having this problem only after I upgraded from 0.17.8 to 0.17.19. Mac without antivirus.

alanpog avatar Nov 29 '16 20:11 alanpog

Strange thing as well is that I need to go throw linking process each time when I delete a package as well. Npm does that faster. And linking really takes long time.

asolopovas avatar Dec 13 '16 16:12 asolopovas

This can be reproduced with this package.json (on Heroku):

{
  "name": "yarn-link-slowness",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "axios": "^0.15.3",
    "lodash": "^4.17.2",
    "react": "^15.4.1",
    "react-dom": "^15.4.1",
    "react-player": "^0.12.1",
    "react-redux": "^4.4.6",
    "react-router": "^3.0.0",
    "react-router-redux": "^4.0.7",
    "react-scripts": "^0.8.4",
    "redux": "^3.6.0",
    "redux-auth-wrapper": "^0.9.0",
    "redux-logger": "^2.7.4",
    "redux-promise-middleware": "^4.2.0",
    "redux-thunk": "^2.1.0"
  },
  "engines": {
    "node": "7.2.1",
    "yarn": "0.17.8"
  }
}

With yarn 0.17.8, the install takes 37s. With yarn 0.17.10, the install takes 97 seconds. No other changes (new Heroku apps each time).

hunterloftis avatar Dec 13 '16 21:12 hunterloftis

✨ Done in 45.10s.

    "autoprefixer": "6.3.6",
    "babel-core": "6.7.6",
    "babel-jest": "13.0.0",
    "babel-loader": "6.2.4",
    "babel-plugin-transform-class-properties": "6.9.1",
    "babel-plugin-transform-object-rest-spread": "6.8.0",
    "babel-preset-es2015": "6.6.0",
    "babel-preset-react": "6.5.0",
    "bluebird": "3.3.5",
    "cardmask": "github:aj0strow/cardmask#v1.0.0",
    "chai": "3.5.0",
    "classnames": "2.2.5",
    "copy-webpack-plugin": "2.1.3",
    "core-js": "2.4.1",
    "css-loader": "0.23.1",
    "enzyme": "2.3.0",
    "file-loader": "0.8.5",
    "force-case-sensitivity-webpack-plugin": "0.1.1",
    "jest": "13.0.0",
    "jest-cli": "13.0.0",
    "json-loader": "0.5.4",
    "lodash": "4.11.1",
    "moment": "2.13.0",
    "ms": "0.7.1",
    "node-sass": "3.4.2",
    "postcss-loader": "0.9.1",
    "raw-loader": "0.5.1",
    "react": "15.2.0",
    "react-addons-css-transition-group": "15.2.0",
    "react-addons-test-utils": "15.2.0",
    "react-css-transition-replace": "2.0.1",
    "react-dom": "15.0.1",
    "react-redux": "4.4.5",
    "react-router": "2.3.0",
    "react-textarea-autosize": "4.0.3",
    "recompose": "0.20.2",
    "redux": "3.5.1",
    "redux-actions": "0.10.0",
    "redux-thunk": "2.0.1",
    "reselect": "2.5.3",
    "sass-loader": "3.2.0",
    "sinon": "1.17.4",
    "style-loader": "0.13.1",
    "webpack": "1.13.0",
    "webpack-dev-server": "1.14.1",
    "whatwg-fetch": "1.0.0",
    "zxcvbn": "4.3.0"

aj0strow avatar Dec 15 '16 14:12 aj0strow

Please, can anyone explain what yarn does in "Linking dependencies" step exactly? Because max number on this step vary from ~1000 to ~65000 for same project on different machines. What does this number mean?

Kreozot avatar Dec 28 '16 10:12 Kreozot

Having this issue as well. Adding a dependency with yarn add seems to trigger "Linking dependencies" and it takes forever. Had to switch back to npm for now.

node: 6.9.2 OS: Windows 10

mpseidel avatar Dec 28 '16 16:12 mpseidel

node: 7.3.0 OS:Windows 10 64 Same for me

image

OlegLustenko avatar Jan 10 '17 11:01 OlegLustenko

Same here. Links 23420...something, and takes about one and a half minutes on a good day.

RichiCoder1 avatar Jan 18 '17 21:01 RichiCoder1

Yarn 0.19.1 NodeJS 7.3.0 Windows 10

yarn add moment takes 105 seconds. It has no dependencies. :/

EDIT: Turning off Windows Defender does reduce time to ~30 to ~50 seconds. I tried excluding the directory I'm working in, but that didn't seem to help.

echobops avatar Jan 20 '17 04:01 echobops

Just ran a fresh copy of create-react-app and it took 876.37s. I understand you don't have much/any control over how anti-virus works but my experience with NPM and CRA was much faster on Windows.

JeffBaumgardt avatar Feb 01 '17 23:02 JeffBaumgardt

On windows 10 just use Ubuntu bash shell as a general advice.

wclr avatar Feb 02 '17 07:02 wclr