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 install hangs during "Fetching packages..." #764

Closed
indieisaconcept opened this issue Oct 11, 2016 · 93 comments · Fixed by #2950
Closed

yarn install hangs during "Fetching packages..." #764

indieisaconcept opened this issue Oct 11, 2016 · 93 comments · Fixed by #2950

Comments

@indieisaconcept
Copy link

indieisaconcept commented Oct 11, 2016

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.

  • yarn@v0.15.1
  • node@v4.4.6
  • osx@10.10.5
@sorgloomer
Copy link

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 xxx@0.0.0: No license field
[1/4] Resolving packages...
warning wdio-mocha-framework > mocha > glob > minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning wdio-mocha-framework > mocha > to-iso-string@0.0.2: to-iso-string has been deprecated, use @segment/to-iso-string instead.
warning wdio-mocha-framework > mocha > jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
[2/4] Fetching packages...
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 868/869

@indieisaconcept
Copy link
Author

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

@kitsunde
Copy link

kitsunde commented Oct 12, 2016

Same issue but with bower.json. In this case it's working on my local macOS. (with a complication #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.

@emrecamasuvi
Copy link

emrecamasuvi commented Oct 12, 2016

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

yarn yarn install v0.15.1 info No lockfile found. warning arabam@1.0.1: No license field [1/4] Resolving packages... warning glob > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue warning gulp.spritesmith > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue warning gulp > vinyl-fs > glob-watcher > gaze > globule > minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue warning gulp > vinyl-fs > glob-watcher > gaze > globule > glob > graceful-fs@1.2.3: 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 > cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain, use it instead! warning gulp.spritesmith > spritesmith > pixelsmith > ndarray-fill > cwise > static-module > through2 > xtend > object-keys@0.4.0: [2/4] Fetching packages...

@jmartsch
Copy link

jmartsch commented Oct 12, 2016

Same issue here
Windows 10
node v6.2.0
npm 3.8.9
yarn@v0.15.1
Using nvm to update or install node versions

@jmartsch
Copy link

jmartsch commented Oct 12, 2016

It works on Windows 10 with
node 6.7.0
npm v3.10.3
yarn@v0.15.1
So it seems to be node or npm version that is conflicting

@sorgloomer
Copy link

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

@sorgloomer
Copy link

Updating to nodejs v6.7.0 solved my issue

@gtrak
Copy link

gtrak commented Oct 12, 2016

Broken on node v4, working on v6.7

@slahav
Copy link

slahav commented Oct 13, 2016

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

@aviadhahami
Copy link

hangs on:

  • node v6.7.0
  • windows 10
  • yarn 0.15.1

@jdelStrother
Copy link

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.

@amasad
Copy link

amasad commented Oct 18, 2016

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

@benjie
Copy link
Contributor

benjie commented Oct 18, 2016

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

@CJBridges
Copy link

CJBridges commented Oct 27, 2016

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.

@CJBridges
Copy link

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.

@qballer
Copy link

qballer commented Nov 16, 2016

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

@wanyine
Copy link

wanyine commented Nov 25, 2016

so do i, sucks
Ubuntu@16.04
Node@6.2.2
Yarn@0.17.8

@zhulduz
Copy link

zhulduz commented Nov 28, 2016

Same issue here
Ubuntu 14.04
node v6.0.0
npm 3.8.6
yarn@v0.17.8

@Asgaroth
Copy link

Asgaroth commented Nov 29, 2016

Same:

OSX: 10.11.6
Node: v5.12.0
Yarn: 0.17.9

Works with node > 6.7

@erik-schafer
Copy link

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

@joncursi
Copy link

I just ran into this.

Node 7.4.0
npm 3.10.9
yarn 0.18.1

@joncursi
Copy link

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

@benlangfeld
Copy link

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

@erik-schafer
Copy link

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.

@benlangfeld
Copy link

benlangfeld commented Jan 15, 2017

My issue turned out to be a disk full condition.

@justinpage
Copy link

justinpage commented Jan 17, 2017

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.
├─ aws-sdk@2.7.23
├─ babel-runtime@6.11.6
├─ base64-js@1.2.0
├─ bottleneck@1.15.0
├─ buffer@4.9.1
├─ crypto-browserify@1.0.9
├─ defaults@1.0.3
├─ ieee754@1.1.8
├─ jmespath@0.15.0
├─ lodash.find@4.6.0
├─ punycode@1.3.2
├─ querystring@0.2.0
├─ sax@1.1.5
├─ url@0.10.3
├─ uuid@3.0.0
├─ winston-aws-cloudwatch@1.4.0
├─ winston@2.2.0
├─ xml2js@0.4.15
└─ xmlbuilder@2.6.2
✨  Done in 16.95s.
λ bundle → λ git develop* →

@BYK BYK self-assigned this Jun 14, 2017
BYK pushed a commit that referenced this issue Jun 14, 2017
**Summary**

Fixes #764.

Turns out when fetching packages from remote sources via Git,
it may ask for a username or password and get stuck there since
we run it in the background. This patch passes the following env
variables to disable any prompts:

1. `$GIT_ASKPASS=""`
   This is the command Git runs to get username and pass. Setting
   it to an empty string disables it and git exits with an error.
2. `$GIT_TERMINAL_PROMPT=0`
    This is new in Git 2.3 and it prevents git from even trying to
    ask for a password. Surpasses `$GIT_ASKPASS` above.
3. `$GIT_SSH_COMMAND="ssh -oBatchMode=yes"
    This is also new in Git 2.3 and it makes git make the call to
    ssh via this command. `BatchMode=yes` option tells ssh to not
    do anything interactive (because batch/script mode) like
    password prompts in case publickey auth fails etc.

**Test plan**

Do `yarn add git+https://github.com/Napsty/privrepo.git#1.0.2`. `yarn`
hangs before this patch and fails with a "Refusing to download" error
after the patch.
@BYK BYK closed this as completed in #3633 Jun 14, 2017
BYK added a commit that referenced this issue Jun 14, 2017
**Summary**

Fixes #764.

Turns out when fetching packages from remote sources via Git,
it may ask for a username or password and get stuck there since
we run it in the background. This patch passes the following env
variables to disable any prompts:

1. `$GIT_ASKPASS=""`
   This is the command Git runs to get username and pass. Setting
   it to an empty string disables it and git exits with an error.
2. `$GIT_TERMINAL_PROMPT=0`
    This is new in Git 2.3 and it prevents git from even trying to
    ask for a password. Surpasses `$GIT_ASKPASS` above.
3. `$GIT_SSH_COMMAND="ssh -oBatchMode=yes"`
    This is also new in Git 2.3 and it makes git make the call to
    ssh via this command. `BatchMode=yes` option tells ssh to not
    do anything interactive (because batch/script mode) like
    password prompts in case publickey auth fails etc.

**Test plan**

Do `yarn add git+https://github.com/Napsty/privrepo.git#1.0.2`. `yarn`
hangs before this patch and fails with a "Refusing to download" error
after the patch.
@BYK BYK moved this from Backlog to Done in Yarn 1.0 Jul 5, 2017
@spointecker
Copy link

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

@wikieswan
Copy link

i try

rm yarn.lock
yarn 

it works for me

@webbrandon
Copy link

webbrandon commented Mar 5, 2018

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.

@indatawetrust
Copy link

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

@Karl-EdwardFPJeanMehu
Copy link

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

@Xuhao
Copy link

Xuhao commented Sep 19, 2018

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

@md8n
Copy link

md8n commented Dec 5, 2018

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

@krunalshahcodes
Copy link

Same issue

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

@LeonSkrilec
Copy link

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

@skycrazyk
Copy link

skycrazyk commented Aug 29, 2019

Same issue

OS Windows 10

My solve: update motherboard drivers

@iqbalhussain931
Copy link

iqbalhussain931 commented Aug 30, 2019

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.

@nzawirski
Copy link

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

@ghasemikasra39
Copy link

ghasemikasra39 commented Jun 12, 2020

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

@ievgennaida
Copy link

ievgennaida commented Jul 16, 2020

Same problem!
Why this one is closed?

yarn@1.22.4
Node.js v12.18.2.

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

Windows 10

@christo8989
Copy link

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. :/

@ws7one
Copy link

ws7one commented May 26, 2021

Weirdy, this worked
yarn clean & yarn cache clean & yarn

@wojtekwtf
Copy link

My download was getting stuck on the last dependency. None of the answers above helped / gave any clue.

I switched to a mobile hotspot and it worked

@boranh
Copy link

boranh commented Jul 15, 2021

My download was getting stuck on the last dependency. None of the answers above helped / gave any clue.

I switched to a mobile hotspot and it worked

Thank You 👌👌

@yarnpkg yarnpkg locked as resolved and limited conversation to collaborators Jul 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.