How do I use multiple npm registries in Yarn?

非 Y 不嫁゛ 提交于 2019-12-02 22:03:00

Yarn doesn't have support --registry flag as npm but you can set up your registry in .yarnrc

If your .yarnrc is being ignored it can be copied out of the ~/.yarnrc using:

yarn config set registry http://registry.com/registry//
Himanshu sharma

You can make a .yarnrc file in the root of the project and write this line in that file:

registry "https://registry.npmjs.org/"

This will act as a project specific repository.

You can try set different registry in .npmrc and .yarnrc.

So for example: In .npmrc:

registry=https://yourcompany/
virtual/:_authToken=credentials
always-auth=true

always-auth=true needs to be the very last line in the file

And in .yarnrc:

registry "https://registry.yarnpkg.com"

Then yarn add/npm install + private-pakage/public-packge will work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!