如何在纱线中指定本地注册表? [英] How to specify local registry in yarn?
本文介绍了如何在纱线中指定本地注册表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个本地的nexus服务器,我希望yarn在上线前浏览一下,基本上是prefer-offline
I have a local nexus server, I'd like yarn to look through it before going online, basically prefer-offline
yarn install --prefer-offline --cache-folder C:\folder\yarn-cache --preferred-cache-folder C:\folder\yarn-cache --non-interactive --no-lockfile --registry http://server/repository/npm-group
Yarn 无法离线找到依赖项,然后无法上线.不知道能不能解决.
Yarn fails to find a dependency offline then fails to go online. I don't know if that can be fixed.
推荐答案
- 创建一个 npm(托管) 存储库以用作您的私有注册表.我相信你已经这样做了.
- 创建一个npm(代理)指向您选择的外部存储库的存储库(https://registry.yarnpkg.com 或 https://registry.npmjs.org/).
- 创建一个 npm(组),在第一位置使用您的私人注册表,在第二位置使用代理注册表.
- 将 yarn 指向您的组存储库:
yarn config set registry http://nexus.local/repository/npm-group/
.如果您的 Nexus 配置需要,请验证纱线:yarn login
. - Create an npm (hosted) repository to use as your private registry. I believe you have already done this.
- Create an npm (proxy) repository pointing to your external repository of choice (https://registry.yarnpkg.com or https://registry.npmjs.org/).
- Create an npm (group) with your private registry on first position and the proxy registry on second position.
- Point yarn to your group repository:
yarn config set registry http://nexus.local/repository/npm-group/
. If required by your Nexus configuration, authenticate yarn:yarn login
.
还要警惕 yarn 使用您可能拥有的任何 npm 配置:https://github.com/yarnpkg/yarn/issues/4862
Also be wary of yarn using any npm config you might have over it's own: https://github.com/yarnpkg/yarn/issues/4862
这篇关于如何在纱线中指定本地注册表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文