Skip to content

"yarn global add" doesn't globally install packages if .yarn-cache was restored #1151

Open
@ide

Description

@ide

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

What is the current behavior?
If you restore .yarn-cache from another machine (e.g. on a CI system) that had a globally installed package, then running yarn global add <pkg> doesn't install the package on the new machine.

If the current behavior is a bug, please provide the steps to reproduce.
Set up a circle.yml file that tells CircleCI to cache ~/.yarn-cache. Run a build and then run it again (make sure in the "Restore cache" step that home/ubuntu/.yarn-cache is restored).

The second time around, even though yarn global add codecov runs successfully and says success Installed [email protected] with binaries: codecov, the codecov package is missing. It doesn't place anything in nvm's global node_modules folder nor the bin folder.

machine:
  pre:
    - mkdir ~/.yarn-cache
  node:
    version: 6

dependencies:
  cache_directories:
    - ~/.yarn-cache
  pre:
    - curl -o- -L https://yarnpkg.com/install.sh | bash
    - yarn global add codecov
  override:
    - yarn

test:
  pre:
    - yarn run lint
  override:
    - yarn test -- --coverage
  post:
    - codecov

What is the expected behavior?
yarn global add <pkg> should reinstall the package. As a workaround, using npm or yarn global remove <pkg> works fine.

Please mention your node.js, yarn and operating system version.
Node 6.8.1 installed with nvm 0.31.0
Yarn 0.15.1 installed via curl + bash
Ubuntu 12.04 on CircleCI

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions