LoginSignup
1
0

More than 5 years have passed since last update.

Yarn v0.15.1でプライベートリポジトリをインストールする方法

Last updated at Posted at 2016-10-14

v0.16.0で普通にできるようになりました。
package.jsonに依存性のGit参照としてgit+sshから始まるURLを書いた状態で、yarn installを行うと失敗します。
今後対応されるらしいですが、現状の対処方法がGitHubのissueにあったのでメモとして残しておきます。
ただし、この変更を行うと環境によってはnpm installが失敗するようになるので、チーム全員Yarnに乗り換える必要があるかもしれません。

失敗するpackage.jsonの例

{
  "name": "hoge",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "private-package": "git+ssh://git@host/user/private-repo.git"
  }
}

対処方法

1. 依存するリポジトリのURLを変更する

- git+ssh://git@host/user/private-repo.git 
+ ssh://host/user/private-repo.git

2. ~/.ssh/configに設定を追加する

Host bitbucket.org
    User git

Host github.com
    User git

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0