Yarn: Git installs don't follow branch on yarn upgrade

Created on 15 Oct 2016  Â·  15Comments  Â·  Source: yarnpkg/yarn

Bug. Steps to reproduce:

  • yarn add org/package#branch
  • update github branch, pointing it to new commit; don't change the version number
  • yarn upgrade

Current result: No change

Expected result: With npm, npm update does install the package from the new commit

Node: 6.3, Yarn: 0.15.1, OS X 10.11.6

Workaround

  1. Find the cached package in ~/.yarn-cache/, it will be named npm-${name}-${version}
  2. Delete it
  3. yarn upgrade

Most helpful comment

@dsibiski so what is the url you used, and what is the commit it installed?
See the Yarn meta info file in the cached package.

I forgot to mention the workaround: delete the package from the cache dir
and install again, that forces it to update.

On Tue, Oct 18, 2016, 1:22 AM Dave Sibiski [email protected] wrote:

@wmertens https://github.com/wmertens It's definitely not the branch
specified, the package in question is a fork of a module where I added a
fix...checking the file I fixed in node_modules shows the old file and
not the one from my branch.

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/1087#issuecomment-254363003, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AADWloNsf52YGG78cdO7SknBy7pIxNohks5q1AM4gaJpZM4KXod2
.

All 15 comments

In my tests it doesn't seem to follow branches even when installing on the first run.

@dsibiski more info please: look at the resulting commit under ~/.yarn-cache/npm-your-package/, and check that the commit is indeed not one that is pointed to by the branch you specify with #branchname

@wmertens It's definitely not the branch specified, the package in question is a fork of a module where I added a fix...checking the file I fixed in node_modules shows the old file and not the one from my branch.

@dsibiski so what is the url you used, and what is the commit it installed?
See the Yarn meta info file in the cached package.

I forgot to mention the workaround: delete the package from the cache dir
and install again, that forces it to update.

On Tue, Oct 18, 2016, 1:22 AM Dave Sibiski [email protected] wrote:

@wmertens https://github.com/wmertens It's definitely not the branch
specified, the package in question is a fork of a module where I added a
fix...checking the file I fixed in node_modules shows the old file and
not the one from my branch.

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/1087#issuecomment-254363003, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AADWloNsf52YGG78cdO7SknBy7pIxNohks5q1AM4gaJpZM4KXod2
.

@dsibiski this might work for you:

I have forked a package, where the original github package was used by yarn instead.

  1. Prefix the forked version with something. I used "1.10.12-eigan"
  2. Ran yarn upgrade
  3. Now my forked package with version 1.10.12-eigan was downloaded.

I had the same issue. Deleting the original package from yarn cache resolved the issue (for the moment)

For me installing anything from a github branch does not work with yarn. I had to go back to npm.
It always installs the default branch, does not use the specified one after #.

I'm currently having issues while trying to install gulp 4.0:

`An unexpected error occurred: "ENOENT: no such file or directory, lstat '/Users/kaisermann/Library/Caches/Yarn/npm-gulp-4.0.0-alpha.2-013259583212bf693d991846c62eb36b8a8e5971'".``

I'm trying to install it with yarn add gulpjs/gulp#4.0

This is happening for me as well. It seems to be installing the most recent matching tag rather than the branch. I am attempting to install user/repo#3.8.x, and it is installing the most recent tag, which is 3.8.8, rather than the branch named '3.8.x'. This is really bad and was causing a serious production issue for us.

None of the workarounds listed here are even working for me. It just refuses to install it correctly seemingly no matter what I do.

EDIT: Upon further testing the tag seems to be a red herring. It's just completely ignoring the branch information and installing maybe like the last time the version was bumped? I don't even know.

I'm actually having the opposite problem, where I originally installed with yarn from a branch and now whenever I try to switch to a different branch or commit hash it uses the branch version instead.

@pzuraq did you remove/recreate the yarn.lock file?

Removed and recreated the yarn.lock file and cleared ~/.yarn-cache/, with the same result. Everytime I install from yarn it's the incorrect version, the branch I first installed from. Currently I'm trying to install directly to git commit.

@pzuraq are you on OS X? The cache location moved to ~/Library/Caches/Yarn

On Thu, Dec 29, 2016 at 11:22 PM Chris Garrett notifications@github.com
wrote:

Removed and recreated the yarn.lock file and cleared ~/.yarn-cache/, with
the same result. Everytime I install from yarn it's the incorrect version,
the branch I first installed from. Currently I'm trying to install directly
to git commit.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/1087#issuecomment-269702720, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AADWlpf0GETeVadkUV1T-qZA4vrvxGtbks5rNDKIgaJpZM4KXod2
.

@wmertens ok, clearing that directory did work. So something is wrong with caching for branches/commits.

Should be fixed now #2074

Was this page helpful?
0 / 5 - 0 ratings