yarn install hangs during "Fetching packages..."

Created on 12 Oct 2016  Β·  90Comments  Β·  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?

Bug

What is the current behavior?

yarn install hangs at fetching packages and does not provide any further information as to the cause.

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

With the following package.json run the below

> yarn cache clean & yarn install

What is the expected behavior?

Installation should succeed.

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

high-priority needs-discussion triaged

Most helpful comment

i try

rm yarn.lock
yarn

it works for me

All 90 comments

I have the same issue on Windows 10 using nodejs v6.2.0 x64.

It hangs when fetching the last package:

C:\xxx>yarn
yarn install v0.15.1
info No lockfile found.
warning [email protected]: No license field
[1/4] Resolving packages...
warning wdio-mocha-framework > mocha > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning wdio-mocha-framework > mocha > [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead.
warning wdio-mocha-framework > mocha > [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
[2/4] Fetching packages...
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 868/869

@sorgloomer yep same behaviour, it is indeed hanging on last package.

Same issue but with bower.json. In this case it's working on my local macOS. (with a complication https://github.com/yarnpkg/yarn/issues/846)

{
  "name": "jaguar",
  "version": "0.0.0",
  "private": true,
  "dependencies": {
    "bootstrap": "~3.3.5",
    "devicejs": "2ae5c775e35ccc837589e5af34e292c54936778c",
    "jquery": "2.1.3",
    "jquery-transform": "e195b9a7118558bb1141e50b80380ea5f31dffb8",
    "moment": "2.14.1",
    "moment-timezone": "0.5.5",
    "owl-carousel2": "2.0.0-beta.2.4",
    "raven-js": "3.5.1",
    "ua-parser-js": "0.7.10",
    "underscore": "1.8.3",
    "object-fit": "~0.4.2",
    "picturefill": "^3.0.2",
    "jquery-selectBox": "316c77f157cb25c7a6ea36822143ac9d97845067"
  },
  "resolutions": {
    "jquery": "2.1.3"
  }
}

Every build on CircleCI that does yarn with this file locks up.

Same issue here.
windows 10
node v6.2.0
npm 3.8.9

yarn yarn install v0.15.1 info No lockfile found. warning [email protected]: No license field [1/4] Resolving packages... warning glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue warning gulp.spritesmith > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue warning gulp > vinyl-fs > glob-watcher > gaze > globule > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue warning gulp > vinyl-fs > glob-watcher > gaze > globule > glob > [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. warning gulp-imagemin > imagemin-gifsicle > exec-buffer > execa > [email protected]: cross-spawn no longer requires a build toolchain, use it instead! warning gulp.spritesmith > spritesmith > pixelsmith > ndarray-fill > cwise > static-module > through2 > xtend > [email protected]: [2/4] Fetching packages...

Same issue here
Windows 10
node v6.2.0
npm 3.8.9
[email protected]
Using nvm to update or install node versions

It works on Windows 10 with
node 6.7.0
npm v3.10.3
[email protected]
So it seems to be node or npm version that is conflicting

I thought the whole point was to exclude the npm client from the equation

Updating to nodejs v6.7.0 solved my issue

Broken on node v4, working on v6.7

hangs on:

  • Node 5.11.1
  • npm 3.8.6
  • macOS 10.12
  • yarn 0.15.1

screen shot 2016-10-12 at 20 53 47

hangs on:

  • node v6.7.0
  • windows 10
  • yarn 0.15.1

My jenkins machine was also seeing the same hang-on-final-package-install, with:

  • node v5.11.0
  • Ubuntu 14.04.2 LTS
  • yarn 0.15.1
  • npm 3.10.8

Upgrading to node 6.8.1 via n has magically fixed it.

Confirmed. Hangs on 6.1.0 and upgrading to 6.8.1 fixed it.

(Same here - Node 6.2 -> 6.8 fixes it)

Failing for me on CircleCI:

  • Ubuntu 14.04 (Trusty)
  • Node v4.4.6
  • yarn 0.16.1
  • npm not executed in this env.
  • Cache/node_modules are cleared via rm -rf node_modules/ && rm -rf ~/.yarn-cache/ && mkdir -p ~/.yarn-cache

Of particular note, it consistently hangs on some file being pulled from a private git repository. The file varies, but it's always that repository.

This command shows the file descriptors opened by a given process:

$ lsof -p <pid of yarn.js process>
( ... results trimmed ... )
node    19551 ubuntu   24w   REG               0,89     2048  457983 /home/ubuntu/.yarn-cache/npm-our-private-pkg-1.0.0/src/styles/fonts/glyphicon.svg

I filed a related issue here on CircleCI forums with other info, probably not more significantly valuable than what is here.
https://discuss.circleci.com/t/yarn-install-hangs-and-never-completes-related-to-dash/7664

Update: Updating to Node v6.9.1 resolves the issue on repeated rebuilds with and without cache.

So, to wrap up some data here in a bow for a troubleshooter:
Affects all OS's, both yarn 0.15.1 and 0.16.1, and appears to be broken in node 6.2 (and earlier) and fixed in Node 6.7 (and later), with no data points reported in the middle.

This seems to happen to me as well.
Ubuntu 14.04
Node 4.4.5
Yarn 0.16.1

Same issue here
Ubuntu 14.04
node v6.0.0
npm 3.8.6
[email protected]

Same:

OSX: 10.11.6
Node: v5.12.0
Yarn: 0.17.9

Works with node > 6.7

Hangs for me as well at 1040/1041
Windows 10
Node v6.9.3
Yarn 0.18.1

I just ran into this.

Node 7.4.0
npm 3.10.9
yarn 0.18.1

Update: I've found that if you let it sit for ~8 minutes, it will eventually go through...

screen shot 2017-01-10 at 4 16 26 pm

Datapoint: I've had this hung for 2 days now. The process wasn't doing anything useful: https://gist.github.com/benlangfeld/24f704753d1564d2db102f972d066008

I figured my issue out, but it might be specific to only a few people.

I'm on windows 10

vanilla-masker was included to be downloaded by yarn, but vanilla-masker is incompatible with windows due to a poorly named directory. I changed the dependency to use lagden-vanilla-masker (https://www.npmjs.com/package/lagden-vanilla-masker), a copy of vanilla-masker which renamed the offending directory to be windows compatible.

My issue turned out to be a disk full condition.

What worked for me was getting off VPN:

before:

Ξ» bundle β†’ Ξ» git develop* β†’ yarn add winston-aws-cloudwatch
yarn add v0.18.1
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: clone git://github.com/realtymaps/ssh2.git /Users/Justin/Library/Caches/Yarn/.tmp/f5257a9a008d54d3956928f15f351a79
Directory: /Users/Justin/Projects/www/MotorTrend/OnDemand/api/assets/bundle
Output:
Cloning into '/Users/Justin/Library/Caches/Yarn/.tmp/f5257a9a008d54d3956928f15f351a79'...
fatal: read error: Operation timed out
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

after:

Ξ» bundle β†’ Ξ» git develop* β†’ yarn add winston-aws-cloudwatch
yarn add v0.18.1
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
warning Unmet peer dependency "request@^2.34".
warning Unmet peer dependency "request@^2.34".
[4/4] πŸ“ƒ  Building fresh packages...
success Saved lockfile.
success Saved 19 new dependencies.
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
└─ [email protected]
✨  Done in 16.95s.
Ξ» bundle β†’ Ξ» git develop* β†’

Having same problem on macOS for a long time already, it randomly slows down on "Fetching packages". For my configuration it takes 2-4 mins avg, but every couple of runs it is 35-30 mins.

npm: 4.0.5
node: 7.4.0
yarn: 0.19.1

Ran into this problem in travis when added a github dependency :(

samesies:
OSX 10.12.2
$ node -v
v6.5.0
$ npm -v
3.10.6
$ yarn --version
0.17.8

For me was the solution to go with "npm install -g yarn" instead of "apt-get install yarn"

Update: Hangs again so npm install was not a solution and it works sometimes. I think it works with version 0.19.0 but not 0.19.1..

Frozen for me. Even tried with "npm install -g yarn". Please fix!!!

Yarn version:
0.19.1

Node version:
4.4.6

Platform:
linux x64

also experiencing this, across multiple project/yarn files, after upgrading to yarn 0.19.1 via npm i -g yarn@latest

yarn 0.19.1
node 6.1.0
macos

for me, downgrading via npm i -g [email protected] worked to be able to yarn install

This is happening to me on our staging servers which had just installed latest.

yarn 0.19.1
node 5.11.1
ubuntu

EDIT: same issue on 0.19.0 and node 5.12.0

EDIT 2: updated to node 6.9.5 and now works

EDIT 3: updated to yarn 0.19.1 again and it is still working

node 6.1.0 => 7.2.1 works

Happened with me as well. Hangs at the last dependency.
Node: v5.12.0
Yarn: v0.20.3
Ubuntu 14.04

FIX: Updated Node to latest version(v7.5.0) and it worked.

Getting this issue lately, any real resolution?

image

Nope just being ignored like usual when big companies make an open source project. If it works for them then who cares if something like this happens.

Contribute a fix or take a hike @robclancy

lmao I love that logic... if something is open source it doesn't matter how many billion dollar companies are behind it with an issue people come into over and over with zero response, the fanboys will defend it blindly.

It's angular and their broken docs all over again.

Go fanboy somewhere else.

You sir are a fool if you think I could ever be a fanboy of anything written in JavaScript. But or course you are only here to troll, not to contribute anything meaningful. You can probably expect this issue to be locked soon as a result.

Actually I was here complaining about an issue that should have a fix or at the very least a response by now, like others. You are here to argue with someone on the internet like a little fanboy.

How about you fix this or take a hike.

Others are her to ask politely about potential progress on the issue. Yarn was never sold to you, so keep your complaining to yourself. You're being "that guy" that makes open-source a pain in the ass.

How ironic.

You're one of these open-source heroes. Go on I'm sure there is another library out there being neglected that you can blindly defend. Be gone hero. Do your work.

I would totally contribute and help but I was looking through the source code and I was legitimately confused on where to even start.

There are projects which I can contribute to with code and I tend to prefer that path. There are other projects where I can only report an issue and hope that someone that's more knowledgeable with the codebase can help find the root cause.

This is definitely the latter hehe.

Let's keep it civil @benjie @robclancy πŸ₯‡

Same issue, hangs on totalpackages - 1
ubuntu linux 4.4.0-64-generic x86_64
node 6.2

@code-by Upgrading to Node 6.8.1 or above seems to fix this issue for most (but not all) people; give that a try. I've not seen the issue since upgrading back in October. Node 7.6 has native support for async/await if that sweetens the deal πŸ˜‰

C'mon! Brand new Mac. Homebrew installed node and npm. Still hangs on last package.
$ node -v v7.7.1
$ npm -v 4.1.2

It's a long shot, but I've also seen this on a Mac if you have a private package referenced in your package.json - it appears to hang, but it's actually asking for your keychain password for ssh. The secure-input glyph (image) appears on the right hand edge of the progress bar, but on a colleague's terminal that was practically invisible. I fixed it by running ssh-add -K before running yarn.

@jdelStrother that was it! I had a private package reference and ssh-add -K && yarn install is the command that got it to work. Thank you and my appreciation, sir!

So our issues with this went away for us locally but I have still been
using NPM in CI because of this happening sometimes. With the last comments
about ssh I decided to check and change any with https. They were just
public github repositories so never needed ssh but I thought if ssh changes
could solve this maybe it was an issue with ssl. And changing those
packages to both a version and one using the github definitions instead of
a https url and first run hasn't hung.

On Fri, Mar 3, 2017 at 4:30 AM DouG Molidor notifications@github.com
wrote:

@jdelStrother https://github.com/jdelStrother that was it! I had a
private package reference and ssh-add -K && yarn install is the command
that got it to work. Thank you and my appreciation, sir!

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/764#issuecomment-283737992, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AA0UF5PKUy1Lx5nlGZF9HMoSIPhEG8-Tks5rhwrOgaJpZM4KUM4j
.

Same here for CircleCI with Ubuntu 14.04 (Trusty) and node v6.9.1.

I fixed the issue in https://github.com/yarnpkg/yarn/pull/2950. There's been a missing timeout.

I'm surprised how much time was wasted on discussions when it was literally a one line fix, counting that I'm not from Javascript background.

Had the issue while using Node 5.12.0 only. Switching to version 6.9.1 of Node (via nvm) fixed the issue for me.

It shouldn't be affected by the Node version because the cause of the issue is the timeout that is not specified. #2950 adds the timeout.

So when timeout happens, does yarn retry and fetch from other servers? Is that why timeout is considered the fix for the hangs?

Yarn retries any requests that failed due network error. This PR makes Yarn to consider the timeout error as a network error. There are no "other servers" but you may get more lucky on next retry if it was a connectivity error between where your app is hosted (EC2) and the CDN in front of registry.yarkpkg.com

apt-get update is freezing forever when I have 'deb https://dl.yarnpkg.com/debian/ stable main' in my sources.list :( - any solution?

Still have this problem with yarn v0.23.2and nodejs 6.1.0. Upgrade to nodejs 6.7.0 solved the problem.

I have this issue too with:
yarn v.0.23.2
nodejs v.7.9.0

and after trying this command:
yarn add semantic-ui

I waited more then two hours and it didn't finish to install

Looks like most cases are fixed with a Node update.
Another way to help debug this is running with --verbose flag, to see what request is hanging.
Otherwise not sure we can do anything here

You can also use strace to see what exactly it hanging.

Same issue, had nvm and would switch node versions to find one that works.

Went from 4.4.6 and 5.12 (no success). node 6.7.0 works, but it's harder to convince team that yarn is a drop-in replacement if we have to switch node versions.

@jeffshek can you try to strace stuck yarn on node 4.4.6 or 5.12? That could potentially help us to find the issue.

So after I switched over to node 6.7, I was able to install, etc.

To try to recreate this issue, I wiped out the yarn.lock, removed all node_modules and switched to node 4.4.6.

I was getting

yarn install

[2/4] 🚚  Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=6.0".
error Found incompatible module

So okay, that looks like some type of diagnosable message ... (Was this error message just hiding the entire time?)

But now when I run yarn install, it just magically ... works (node 4.4.6). So now even on node 4.4.6, I'm able to yarn install just fine with the same package.json that wouldn't work a few hours ago. I've removed yarn.lock, done a fresh yarn install, and it continues to work.

I really wish I could be more more help, but using nvm to switch to version 6.7 and then back to 4.4.6 made the previous issue disappear.

I'm new to yarn. Tried it for the first time. Ran yarn install. Result: hanging indefinitely during install of packages. (Specifically, the jsesc package, but not sure that matters.)

Turns out, yarn also botched my NPM commands? o_O "npm clean" now no longer works after a simple brew install yarn and yarn install. That's all I did in a project folder, and my GLOBAL Node modules are now borked.

Yarn version is 0.24.6
Node.js version is 7.10.0

Since installing Yarn, Node looks completely broken.

_Update: I finally got Node / NPM working again, but Yarn still hangs._

For me, it hangs here indefinitely:
screen shot 2017-05-26 at 6 21 03 pm

This appears to still be a persistent issue. I'm able to reproduce with:

[email protected]
[email protected]
[email protected]
[email protected]
amazon [email protected]
[email protected]
[email protected]

appears to be successful for node@>=6.9.5

As far as I can tell, the issue seems to be related to git repo dependencies due to a race condition when extracting the tar produced from git archive .

I made a repo that exhibits the behavior.
https://github.com/andrsnn/yarn-git-dependency-issue

So far I've tracked the issue down this this bit of code located in ~/.yarn/lib-legacy/util/git.js

_cloneViaLocalFetched(dest) {
    var _this4 = this;

    return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
      yield (_child || _load_child()).spawn('git', ['archive', _this4.hash], {
        cwd: _this4.cwd,
        process: function process(proc, resolve, reject, done) {
          const extractor = tar.Extract({ path: dest });
          extractor.on('error', reject);
          extractor.on('end', done);

          proc.stdout.pipe(extractor);
        }
      });
    })();
}

At this step, the dependency repository appears to have been successfully cloned down into a tmp folder /Users/andrsnn/Library/Caches/Yarn/.tmp/06cc8c2b5aba0eca42bd03dabc0d87f6 , extracting to a destination at /Users/andrsnn/Library/Caches/Yarn/npm-yarn-dependency-a-1.0.2-fc796525f8a9e3130248520d386f9823502eb6cd . Does not appear to be a network problem.

Occasionally the 'end' event is never fired from the node-tar module. It appears to hang on a 'data' emit, which contains a trucated chunk of the yarn.lock file from the git dependency.

β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘ 176/177{ '0': 'data',
  '1': <Buffer 30 2e 34 3a 0a 20 20 76 65 72 73 69 6f 6e 20 22 34 2e 30 2e 36 22 0a 20 20 72 65 73 6f 6c 76 65 64 20 22 68 74 74 70 73 3a 2f 2f 72 65 67 69 73 74 72 ... > }
0.4:
  version "4.0.6"
  resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"

lodash.isstring@^4.0.1:
  version "4.0.1"
  resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"

lodash.keys@^3.0.0:
  version "3.1.2"
  resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a"
  dependencies:
    loda

To determine the above I wrapped the event emitter:

_cloneViaLocalFetched(dest) {
    var _this4 = this;

    return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
      yield (_child || _load_child()).spawn('git', ['archive', _this4.hash], {
        cwd: _this4.cwd,
        process: function process(proc, resolve, reject, done) {
          const extractor = tar.Extract({ path: dest });

          var timeout;
          function log(args) {
            return function() {
              console.log(require('util').inspect(args));
              console.log(args[1].toString());
            };
          }
          function debug(emitter) {
              var originalEmitter = emitter.emit;

              emitter.emit = function() {
                  console.log('eventName', arguments[0]);
                  clearTimeout(timeout);
                  timeout = setTimeout(log(arguments), 20000);
                  originalEmitter.apply(emitter, arguments);
              };
          }

          debug(extractor);
          extractor.on('error', reject);
          extractor.on('end', done);


          proc.stdout.pipe(extractor);
        }
      });
    })();
}

This very well could be a bug in node-tar or a dependency it relies on.

Hopefully others can shed some light on the fix. Been having a difficult time with this bug, causing issues on CI servers and in local development.

Thanks a lot for the repro stapes and analysis.
We had an issue of a tar to be download twice and that caused and exception
during untarring.

The core team will focus on stability all through next week before
releasing 0.26

On 28 May 2017 at 22:44, andrsnn notifications@github.com wrote:

This appears to still be a persistent issue. I'm able to reproduce with:

[email protected]
[email protected]
[email protected]
[email protected]
amazon [email protected]
[email protected]
[email protected]

appears to be successful for node@>=6.9.5

As far as I can tell, the issue seems to be related to git repo
dependencies due to a race condition when extracting the tar produced from git
archive .

I made a repo that exhibits the behavior.
https://github.com/andrsnn/yarn-git-dependency-issue

So far I've tracked the issue down this this bit of code located in
~/.yarn/lib-legacy/util/git.js

_cloneViaLocalFetched(dest) {
var _this4 = this;

return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
  yield (_child || _load_child()).spawn('git', ['archive', _this4.hash], {
    cwd: _this4.cwd,
    process: function process(proc, resolve, reject, done) {
      const extractor = tar.Extract({ path: dest });
      extractor.on('error', reject);
      extractor.on('end', done);

      proc.stdout.pipe(extractor);
    }
  });
})();

}

Occasionally the 'end' event is never fired from the node-tar module. It
appears to hang on a 'data' emit, which contains a trucated chunk of the
yarn.lock file from the git dependency.

β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘ 176/177{ '0': 'data',
'1': 0.4:
version "4.0.6"
resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"

lodash.isstring@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451"

lodash.keys@^3.0.0:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a"
dependencies:
loda

To determine the above I wrapped the event emitter:

_cloneViaLocalFetched(dest) {
var _this4 = this;

return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
  yield (_child || _load_child()).spawn('git', ['archive', _this4.hash], {
    cwd: _this4.cwd,
    process: function process(proc, resolve, reject, done) {
      const extractor = tar.Extract({ path: dest });

      var timeout;
      function log(args) {
        return function() {
          console.log(require('util').inspect(args));
          console.log(args[1].toString());
        };
      }
      function debug(emitter) {
          var originalEmitter = emitter.emit;

          emitter.emit = function() {
              console.log('eventName', arguments[0]);
              clearTimeout(timeout);
              timeout = setTimeout(log(arguments), 20000);
              originalEmitter.apply(emitter, arguments);
          };
      }

      debug(extractor);
      extractor.on('error', reject);
      extractor.on('end', done);


      proc.stdout.pipe(extractor);
    }
  });
})();

}

This very well could be a bug in node-tar or a dependency it relies on.

Hopefully others can shed some light on the fix. Been having a difficult
time with this bug, causing issues on CI servers and in local development.

β€”
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/764#issuecomment-304542314, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACBdWLWEI3Aui9XTLxl7ISk-OaXSQLL0ks5r-eqlgaJpZM4KUM4j
.

Was having this issue for the last few week since updating yarn, and fixed it eventually by bumping the version of node from 6.2.0 to 6.9.0. Hope this helps others.

Same problem. Got stuck on the last package while "Fetching packages". Not happening in every project, but most of my projects got this issue. I've reinstalled my system yesterday so may be that previous version didn't have this issues or the package that is doing mess was already cached or whatever.

Yarn version: v0.24.6
Node version: tried v8.0.0, v7.10.0, v7.9.0, nothing worked
OS: macOS 10.12.5

Yarn installed via brew, node via nvm in order to try more versions of node.

// EDIT
ssh-agent prompted for passphrase and yarn swallowed it. When I hit enter, I could see the question once again because "I've entered incorrect passphrase"

@vass-david with your latest edit, are you still having the issue?
@andrsnn - I've tried to reproduce the issue with your repo using various combinations of Node 4.8, Node 6.10, Node 7, Node 8 and yarn 0.24, 0.25, master. I couldn't reproduce the issue. can you confirm it is not there anymore?

@vass-david @JulianLeviston can you use strace on the stuck yarn process to find out what exactly is stuck? Here is a great manual how to use it.

@BYK no, since now I understand what is the issue and that I should simply enter my passphrase for ssh. On the other side it shouldn't swallow this prompt message, so if user is not aware of this, he might never realise that happened.
@kirs do you still need this even if now I know what is the issue?

@kirs Mine's working since I updated yarn.

Had the same issue. Deleting the node_modules folder completely and rerun yarn worked for me!

i try

rm yarn.lock
yarn

it works for me

I had the issue with node 7.10.0 and yarn v0.24.6 in docker but realized the node_modules folder accidentally got push. Removing the node_modules folder and yarn clear cache resolved the issue.

this is happening in large packages. it can be nice if a warning is given on a certain size.

I had the same issue. I believe it is version conflict with node. My project was using v81.2. I simply switched to the correct version and yarn stoped hanging:
nvm use v7.4

Still have this problem in v1.9.4, but same as #5055

Had the same problem:
OS: OSX 10.14.1 (Mojave)
Node: 10.9.0
Yarn: 1.12.3

Looks like it was probably a corrupted yarn.lock file. Doing the following fixed it:

yarn cache clean
rm yarn.lock
rm - r node_modules

yarn

Same issue

OS: OSX 10.14.1 (Mojave)
Node: 12.3.1
Yarn: 1.16.0

I solved it by switching to different network (hotspot). I guess our office network firewall had some restrictions.

Same issue

OS Windows 10

My solve: update motherboard drivers

Had the same problem:
OS: Ubuntu 18.04
Node: v8.10.0
Yarn: 1.17.3

I solved it by doing the following:
yarn cache clean

than again tried the install command and it works. though it takes few minutes to complete the process so be patient it will work. In my case it took 10 minutes (Depends on the internet speed) to complete the process.

Updating yarn did not help. In my case one of the packages was too large and couldn't download before the timeout

Solution is to install using
yarn install --network-timeout 100000

or add .yarnrc file to your project and put this inside:
network-timeout 500000

same here:

yarn install v1.22.4
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[###############################################################################################] 1908/1909
System:
    OS: macOS 10.15.3
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 192.86 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
    Yarn: 1.22.4 - ~/Documents/youpendo-app-bareworkflow/node_modules/.bin/yarn
    npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_232 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: ^4.8.0 => 4.9.0
    react: 16.11.0 => 16.11.0
    react-native: 0.62.2 => 0.62.2
  npmGlobalPackages:
    *react-native*: Not Found

Same problem!
Why this one is closed?

[email protected]
Node.js v12.18.2.

Executed for this repo:
https://github.com/metabase/metabase

Windows 10

Long story short, check your vpn. Is it connected?

A coworker and I were debugging this same issue. It would just stop at a specific package although we weren't sure which package.

Basically, the person had restarted their computer earlier and when they started it back up, they also had to setup a new password for their vpn. So their vpn never automatically reconnected. Since it was an "issue with yarn", I didn't think much about the vpn. But we have a company repo with a few packages and that is where it was hanging. :/

Was this page helpful?
0 / 5 - 0 ratings