Installing private package from Github Package registry fails with not found/not authorized

后端 未结 3 447
臣服心动
臣服心动 2021-01-04 21:48

I created and published a private Github package. Trying to install it with yarn at first, I face the following issue:

Whether I try with yarn or npm, it cannot find

3条回答
  •  青春惊慌失措
    2021-01-04 21:58

    What you need to do is specify where to retrieve EACH package, with something like this in your .npmrc (I don't know the yarn syntax, but it works with yarn when it reads the .npmrc):

    //registry.npmjs.org/:_authToken=
    //npm.pkg.github.com/:_authToken=
    @foo:registry=https://npm.pkg.github.com
    @far:registry=https://registry.npmjs.org
    

    And then, Yarn will search @foo/mypackage1 in Github, where @far/mypackage2 will be searched in npmjs. The default registry will be kept for the others, whatever you set it to.

提交回复
热议问题