Yarn install hangs and never completes



Build (skipped the middle since it was boring)


The build hangs at this point and eventually circle times out (no output for 10 minutes) and kills the build.

Circle.yml file (relevant portions):
machine: pre: - mkdir -p ~/.yarn-cache environment: RAILS_ENV: test RACK_ENV: test NODE_ENV: test dependencies: override: - nvm install v4.4.6 # default version in image of 0.x.y can't run yarn - nvm alias default v4.4.6 - sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 - echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list - sudo apt-get update -qq - sudo apt-get install -y -qq yarn - mkdir -p node_modules && rm -r node_modules/ - yarn install --pure-lockfile # this is the step that hangs cache_directories: - "~/.yarn-cache"

Tightest reproducible case

  • The tightest reproducible case I could come up with was:
  1. SSH into the node
  2. /bin/dash since that’s the shell used by Circle to run commands apparently. (Note: no errors seen when using bash shell, which is the default upon ssh’ing in)
  3. yarn install --pure-lockfile

Expectd: yarn install succeeds
Actual: yarn install fails as above.

Some approaches attempted (none succeeded):

  1. Change the line in circle.yml to push it toward bash ( - /bin/bash -c "yarn install --pure-lockfile")
  2. Redirect all output to /dev/null (- yarn install --pure-lockfile >/dev/null 2>/dev/null)
  3. Turn off emoji (yarn install --no-emoji --pure-lockfile)

My very ugly hack to bring this temporarily operational was:

  1. Set the install command to - sleep 150 && yarn install
  2. SSH into the node during build, stay in bash shell
  3. Wait until the sleep is entered, run yarn install to completion

Cache is now seeded and future builds run without errors. Rebuilding without cache re-introduces the failure.

Any other suggestions on why dash/yarn would not be playing nice together? Nothing obvious appeared when looking through the yarnpkg issues on github.


The instructions here work, have you given them a try?

  1. I’ve tried a lot of different approaches, including installing yarn via npm as suggested in your linked post. Yarn itself installs fine, just the follow-on yarn install of my project fails.
  2. After a lot of further investigation, it looks closely related to these two issues from yarnpkg:

I’ve included more detail there and will continue to work with the yarn team on resolution.


A workaround for this (far from ideal, but our org can use this workaround) is to upgrade node to version 6.9.1 (the latest LTS release).

Please see the github issues linked for more details. Still pending triage/resolution by the yarn team.