{"action":"created","issue":{"url":"https://api.github.com/repos/yarnpkg/yarn/issues/1151","repository_url":"https://api.github.com/repos/yarnpkg/yarn","labels_url":"https://api.github.com/repos/yarnpkg/yarn/issues/1151/labels{/name}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/issues/1151/comments","events_url":"https://api.github.com/repos/yarnpkg/yarn/issues/1151/events","html_url":"https://github.com/yarnpkg/yarn/issues/1151","id":183347816,"number":1151,"title":"\"yarn global add\" doesn't globally install packages if .yarn-cache was restored","user":{"login":"ide","id":379606,"avatar_url":"https://avatars.githubusercontent.com/u/379606?v=3","gravatar_id":"","url":"https://api.github.com/users/ide","html_url":"https://github.com/ide","followers_url":"https://api.github.com/users/ide/followers","following_url":"https://api.github.com/users/ide/following{/other_user}","gists_url":"https://api.github.com/users/ide/gists{/gist_id}","starred_url":"https://api.github.com/users/ide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ide/subscriptions","organizations_url":"https://api.github.com/users/ide/orgs","repos_url":"https://api.github.com/users/ide/repos","events_url":"https://api.github.com/users/ide/events{/privacy}","received_events_url":"https://api.github.com/users/ide/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-17T07:51:53Z","updated_at":"2016-10-21T20:01:07Z","closed_at":null,"body":"**Do you want to request a *feature* or report a *bug*?**\r\nBug\r\n\r\n**What is the current behavior?**\r\nIf 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.\r\n\r\n**If the current behavior is a bug, please provide the steps to reproduce.**\r\nSet 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).\r\n\r\nThe second time around, even though `yarn global add codecov` runs successfully and says `success Installed codecov@1.0.1 with binaries: codecov`, the `codecov` package is missing. It doesn't place anything in nvm's global `node_modules` folder nor the `bin` folder.\r\n\r\n```yml\r\nmachine:\r\n  pre:\r\n    - mkdir ~/.yarn-cache\r\n  node:\r\n    version: 6\r\n\r\ndependencies:\r\n  cache_directories:\r\n    - ~/.yarn-cache\r\n  pre:\r\n    - curl -o- -L https://yarnpkg.com/install.sh | bash\r\n    - yarn global add codecov\r\n  override:\r\n    - yarn\r\n\r\ntest:\r\n  pre:\r\n    - yarn run lint\r\n  override:\r\n    - yarn test -- --coverage\r\n  post:\r\n    - codecov\r\n```\r\n\r\n**What is the expected behavior?**\r\n`yarn global add <pkg>` should reinstall the package. As a workaround, using npm or `yarn global remove <pkg>` works fine.\r\n\r\n**Please mention your node.js, yarn and operating system version.**\r\nNode 6.8.1 installed with nvm 0.31.0\r\nYarn 0.15.1 installed via curl + bash\r\nUbuntu 12.04 on CircleCI"},"comment":{"url":"https://api.github.com/repos/yarnpkg/yarn/issues/comments/255452232","html_url":"https://github.com/yarnpkg/yarn/issues/1151#issuecomment-255452232","issue_url":"https://api.github.com/repos/yarnpkg/yarn/issues/1151","id":255452232,"user":{"login":"WoodyWoodsta","id":8268040,"avatar_url":"https://avatars.githubusercontent.com/u/8268040?v=3","gravatar_id":"","url":"https://api.github.com/users/WoodyWoodsta","html_url":"https://github.com/WoodyWoodsta","followers_url":"https://api.github.com/users/WoodyWoodsta/followers","following_url":"https://api.github.com/users/WoodyWoodsta/following{/other_user}","gists_url":"https://api.github.com/users/WoodyWoodsta/gists{/gist_id}","starred_url":"https://api.github.com/users/WoodyWoodsta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WoodyWoodsta/subscriptions","organizations_url":"https://api.github.com/users/WoodyWoodsta/orgs","repos_url":"https://api.github.com/users/WoodyWoodsta/repos","events_url":"https://api.github.com/users/WoodyWoodsta/events{/privacy}","received_events_url":"https://api.github.com/users/WoodyWoodsta/received_events","type":"User","site_admin":false},"created_at":"2016-10-21T20:01:07Z","updated_at":"2016-10-21T20:01:07Z","body":"I'm having the same issue, but with different circumstances. If I install a new version of node alongside an old version (using `nvm`), then `yarn global add` does not result in any packages being installed in the new bin. I assume that installing `yarn` in the new version of node results in the cache being \"restored\" from the old version of node?"}}
{"actor":{"display_login":"WoodyWoodsta"}}