Yarn: Yarn couldnt find match for specific commit in "_c"

Created on 15 Sep 2017  ·  19Comments  ·  Source: yarnpkg/yarn

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

Bug

What is the current behavior?
In package.json:
"backbone": "git+https://github.com/jashkenas/backbone#6a82b0c897c97bbfb8c5f9cb6b5516feb8d3c778",

running yarn:

yarn install v1.0.1
[1/4] Resolving packages...
[2/4] Fetching packages...
error Couldn't find match for "6a82b0c897c97bbfb8c5f9cb6b5516feb8d3c778" in "_c" for "https://github.com/jashkenas/backbone".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

If the current behavior is a bug, please provide the steps to reproduce.

add the listed above dependency to your package json "dependencies" field and run yarn install also make sure yarn cache is clean if is not reproducible

What is the expected behavior?
yarn would install dep with commit hash reference.
The commit exists and accesibble: https://github.com/jashkenas/backbone/commit/6a82b0c897c97bbfb8c5f9cb6b5516feb8d3c778

It was working on yarn 0.27.3

Please mention your node.js, yarn and operating system version.

centos 6.9.0
nodejs: 8.2.0
yarn: 1.0.1

Most helpful comment

try yarn cache clean

All 19 comments

Weird (maybe someone can explain this?) but this issue went away when I removed this line from my ./ssh/config:
UserKnownHostsFile /dev/null

I dont see direct connection, but first need to glance at code in yarnpkg

Any known workarounds? We can't use yarn on our Ubuntu build server right now due to this bug.

:man_facepalming: my bad, looks like it was a reference to a non-existent commit in the package.json. Leaving the comment here in case it helps someone.

try yarn cache clean

I can't believe such essential thing is broken for what's possibly months. Installing the last pre-v1 yarn version works: https://github.com/yarnpkg/yarn/releases/tag/v0.28.4

😬 I too cannot believe this has been broken for so long ... I use this functionality all the time and just upgrade yarn to find it broken.

wow its still here, maybe we really could look at it this weekend :)

This could really use a nicer error message :)

For me it was specifying a git commit I had not pushed yet... 🤦‍♂️

still experiencing this issue

Solution which worked for me:
I cleaned the cache yarn cache clean & then removed the dependency from package.json, and rerun yarn add[package].

Make sure your version of Git is up to date. This fixed the problem for me.
(a little more detail: Also tagging the commits in older version of Git seemed to fix the problem as well -- even if you don't reference it by that tag. I think that Yarn might not be getting the full list of commit hashes from old Git versions)

I replicated this by removing a tag, and retagging a different commit. The old commit hash was in the yarn.lock file, so the cache clean was not relevant.

I re-generated the yarn.lock file to fix this, but I am working on a very small project, so removing and re-adding is a better approach.

Is this a bug or a feature? Perhaps by design to lock to the latest commit of a branch when building?

Here's what I had to do:

yarn cache clean
rm yarn.lock
yarn install

(installation succeeded but the build failed because of version trouble)

git checkout -- yarn.lock
rm -rf node_modules
yarn install

Now I can install the packages from the original lockfile... something I couldn't do just a moment ago!

It was a little confusing.

@micahscopes unfortunately it doesn't work for me

I have pretty the same problem.
In package.json: "my-package": "git+http://10.1.1.1:4222/frontend/components.git#7d92hd7n3hd"

> yarn
yarn install v1.13.0
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error Couldn't find match for "7d92hd7n3hd7c095eece942cdd647fb7ace33d3c" in "refs/heads/FEATURE-1, refs/heads/FEATURE-2, refs/tags/v0.0.1, refs/tags/v0.0.2" for "git+http://10.1.1.1:4222/frontend/components.git#7d92hd7n3hd"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

or this (on another mac):

> yarn install                                                                                      1 ↵
yarn install v1.13.0
[1/4] 🔍  Resolving packages...
error Command failed.
Exit code: 1
Command: git
Arguments: fetch --tags
Directory: /Users/yekver/Library/Caches/Yarn/v4/.tmp/7d92hd7n3hd7c095eece942cdd647fb7ace33d3c
Output:
From http://10.1.1.1:4222/frontend/components
 ! [rejected]        v0.0.1    -> v0.0.1  (would clobber existing tag)
 ! [rejected]        v0.0.2    -> v0.0.2  (would clobber existing tag)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Problem has gone after: yarn cache clean

OS: macOS 10.14.2
Node.js: 11.6.0

npm config set proxy http://username:password@host:port
npm config set https-proxy http://username:password@host:port

yarn config set proxy http://username:password@host:port
yarn config set https-proxy http://username:password@host:port

git config --global http.proxy http://username:password@host:port
git config --global https.proxy http://username:password@host:port

My problem was my yarn.lock was referring to a commit that no longer existed (because it was on a branch that had been rebased). I ran yarn add my-package#branch and it pulled in the right commit hash.

FWIW, and maybe this is a bad idea, I simply manually updated my yarn.lock file with the correct git hash under resolved of the dependency.

Was this page helpful?
0 / 5 - 0 ratings