Do you want to request a feature or report a bug?
bug
What is the current behavior?
When a package version refers to a Github pull request:
"chai-properties": "vbardales/chai-properties#pull/8/head"
Yarn can't find it:
console
[1/4] 馃攳 Resolving packages...
error Couldn't find match for "pull/8/head" in "fix-negate,master,multi-dimension,10/head,10/merge,11/head,11/merge,3/head,4/head,6/head,7/head,8/head,8/merge,9/head,9/merge,1.0.0,1.0.2,1.1.0,1.2.0" for "https://github.com/vbardales/chai-properties.git".
If the current behavior is a bug, please provide the steps to reproduce.
Add a package with the version specified as a Github pull request (example above), then yarn.
What is the expected behavior?
It should find the pull request and use it as npm does.
Please mention your node.js, yarn and operating system version.
node: 6.7.0
yarn: 0.16.1
MacOS: 10.12.1
Similar issue with a package require like this:
[...]
"libsass-compass-vertical-rhythm": "github:neoeno/libsass-compass-vertical-rhythm.git#7a71b8d"
[...]
It is understood and installed correctly by npm, but currently yarn exits with error:
[...]
cross-spawn-async](https://github.com/IndigoUnited/node-cross-spawn-async) instead.
error Command failed.
Exit code: 128
Command: git
Arguments: clone github:neoeno/libsass-compass-vertical-rhythm.git /home/build/.yarn-cache/.tmp/ef16662fa29e0ad06910839d366d90f5
Directory: /home/test
Output:
Cloning into '/home/build/.yarn-cache/.tmp/ef16662fa29e0ad06910839d366d90f5'...
ssh: Could not resolve hostname github: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
node: v6.7.0
yarn: v0.16.1
Same for me :
npm install mulesoft-labs/osprey-method-handler#pull/18/head --save
works but Yarn throw me an error with :
yarn add mulesoft-labs/osprey-method-handler#pull/18/head
try without pull, it worked for me with another package
yarn add mulesoft-labs/osprey-method-handler#18/head
yarn add mulesoft-labs/osprey-method-handler#18/head
seems to be working.
Agreed. Works without pull/ so I'm happy to close this as a solution. I don't know if it's a Github change or npm/yarn difference that means pull/ doesn't work anymore.
Also, when yarn offered up what 'tag' options there were I noticed all PR's had 123/head but some also had 123/merge. Google-fu failed me. Anyone know what the difference with /merge would be?
I think this should be reopened. Docs saying that yarn can consume same package.json as npm what is not the case for github pull requests. This breaks ability to use yarn and npm together in a project.
@jelhan That makes sense. Reopening...
PLUS one. This is essential
Dug into this a bit. This is due to git-ref-resolver automatically adding refs/pull/ as a prefix when scanning for the reference.
const REF_PR_PREFIX = 'refs/pull/';
const tryVersionAsPullRequestNo = ({version, refs}: ResolveVersionOptions): ?ResolvedSha =>
tryRef(refs, `${REF_PR_PREFIX}${version}`);
so if you specify pull/1/head then yarn is looking for a reference named refs/pull/pull/1/head
It should be easy to add a fallback to try both with and without the refs/pull/ prefix. I'll get a PR together...
@damonmaria re:
Also, when yarn offered up what 'tag' options there were I noticed all PR's had 123/head but some also had 123/merge. Google-fu failed me. Anyone know what the difference with /merge would be?
I believe that the /head is the actual PR code, and /merge is the result of the merge is the PR was accepted/merged
In other words, if PR 10 is a request to merge from branch bugfix to master, then pull/10/head is the code in bugfix and pull/10/merge is the code that would result from merging bugfix to master. I could be wrong though...
@BYK I am using [email protected] and this problem still occurs
$ yarn add webpack-contrib/npm-install-webpack-plugin#pull/115/head
yarn add v1.6.0
[1/5] 馃攳 Validating package.json...
[2/5] 馃攳 Resolving packages...
error Couldn't find match for "pull/115/head" in "refs/heads/1-release,refs/heads/13-dev,refs/heads/16-loaders,refs/heads/17-resolve,refs/heads/18-cli-options,refs/heads/2-example,refs/heads/23-babelrc,refs/heads/28-package-json,refs/heads/29-inline-loaders,refs/heads/3-args,refs/heads/30-webpack2,
It will only work with either
$ yarn add webpack-contrib/npm-install-webpack-plugin#115/head
or
$ yarn add webpack-contrib/npm-install-webpack-plugin#refs/pull/115/head
Most helpful comment
I think this should be reopened. Docs saying that yarn can consume same
package.jsonas npm what is not the case for github pull requests. This breaks ability to use yarn and npm together in a project.