如何覆盖特定项目的全局纱线注册表 [英] How to override global yarn registry for particular project

查看:47
本文介绍了如何覆盖特定项目的全局纱线注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于大多数项目,我从内部服务器拉取包,所以它是由

For most projects I pull packages from the internal server, so it's been added by

yarn config set registry http://custom-packages-server.com

但现在在新项目中,我想使用不同的(默认)一个,但仅在该特定项目中使用它.据我了解,如果我在新项目的目录中运行以下命令

But now in the new project I'd like to use the different (default) one, but use it in that particular project only. As far as I understood if I run the following command inside of new project's directory

yarn config set registry https://registry.yarnpkg.com

它也将更新所有其他项目的全局注册表值,因此他们也会在新位置寻找包.

it's going to update global registry value for all other projects as well, so they also will be looking for packages in the new place.

那么纱线是否有可能仅覆盖特定项目的全局注册表记录?

So is there a possibility in yarn to override global registry record for a specific project only?

推荐答案

找到了实现方法.

事实证明,您可以使用项目目录中的 .yarnrc 文件(是的,几乎和 .npmrc 一样).您可以在那里指定纱线将首先查看的自定义配置属性.

It turned out that you can use .yarnrc file inside the project's directory (yeah, pretty much the same like .npmrc). And there you can specify custom config properties which yarn will look into first.

这就是我的 .yarnrc 文件现在的样子.

So that's how my .yarnrc file looks now.

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

这篇关于如何覆盖特定项目的全局纱线注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆