Node Version: v7.6.0
yarn Version: 0.15.1
In my package.json:
"<node-xxxx>": "github:<gitUserName>/<projectName>#<Branch-not-master>",
Got:
yarn add v0.15.1
[1/5] 馃攳 Resolving packages...
error Couldn't find match for "master" in "v1,v2" for "github:<gitUserName>/<projectName>".
info Visit http://yarnpkg.com/en/docs/cli/add for documentation about this command.
It doesn't had master branch.
We use 0.17.4 which has support for github package on whatever SHA (branch or commit).
I updated v0.21.3
Got an error error An unexpected error occurred: "Error connecting to repository. Please, check the url.".
EDIT:
I found why. yarn does not support private project!
Our github project dependency is also a private repository. The computer has an ssh key with access to the private repository.
npm work fine
How to debug this?
Cause HERE
Request "https://github.com/<private-project>.git/info/refs?service=git-upload-pack" finished with status code 401.
Any walkaround for this?
For me yarn add git+ssh://[email protected]/<gitUserName>/<projectName>.git#<Branch> works when adding, but when running fresh yarn install the branch is ignored and it grabs master
Yarn v0.21.3
The following script doesn't repro your issue - can you update it to highlight the problem you have (with the latest release), then create a new issue if it's still there? Thanks!
#!/usr/bin/env bash
YARN=${YARN:-yarn}
TEMP="$(mktemp -d)"
trap 'rm -rf "$TEMP"' EXIT
echo $TEMP
cd "$TEMP"
printf '{ "name": "main", "version": "1.0.0", "license": "MIT", "dependencies": {} }' > package.json
$YARN cache clean
$YARN add git+ssh://[email protected]/arcanis/private-pkg.git
$YARN install
$YARN add git+ssh://[email protected]/arcanis/private-pkg.git#branch
$YARN install
ls -l node_modules node_modules/*
I wasn't able to reproduce with your script either, I must have been confused somewhere. Thanks!
About my issue, I finally found out WHY.
I use github:<gitUserName>/<projectName>#<Branch-not-master> as my git remote url.
yarn use https protocol fetch data, but npm used git.
SO, I need provide procotol on the remote url!
@arcanis
This is less painful than publishing a namespaced package:
yarn add git+ssh://[email protected]/yargs/yargs.git
Most helpful comment
For me
yarn add git+ssh://[email protected]/<gitUserName>/<projectName>.git#<Branch>works when adding, but when running freshyarn installthe branch is ignored and it grabsmasterYarn v0.21.3