npm - yarn 工作区的私有 npm 注册表有问题
问题描述
我正在尝试yarn workspaces
使用具有私有依赖项的模块 - 以便在以下位置指定这样的一行.npmrc
:
//npm.pkg.github.com/:_authToken=this-is-some-fake-token
令牌显然不同。因此,当我yarn
从该模块内部运行时,它会很好地抓取私有模块,但是当我尝试从工作区根目录运行它时,它会失败并出现错误,即在 npm 注册表上找不到给定的私有模块(但当然它不能- 它可能甚至不应该在那里寻找):
error Couldn't find package "@namespace/module@1.1.4" required by "one-of-workspaces@0.0.1" on the "npm" registry.
显然,在这种情况下,纱线不尊重.npmrc
我已经放入工作区根目录,但为什么呢?或者它甚至不应该?并且不支持工作区模式下的私有注册表?
解决方案
Yarn 会尊重.npmrc
你的主目录(不是 100% 确定 monorepo 根目录)。
您肯定缺少的.npmrc
是提到@namespace
应该从 GPR 中挑选包裹的那一行:
//npm.pkg.github.com/:_authToken=this-is-some-fake-token
@namespace:registry=https://npm.pkg.github.com/
推荐阅读
- java - 检查二维数组中的特定索引以宣布获胜者
- mysql - 从一对多关系中获取数据作为数组
- selenium - 如何使用 selenium chromedriver 启用保存密码
- python - 在 Python 中模拟抢占式 M/M/1 队列时出现问题
- angular - ci/cd 部署 npm 安装问题。npm WARN 旧锁文件
- python - Pyttsx3(python 包)ModuleNotFoundError: No module named 'Foundation._context.Swift'; 'Foundation._context' 不是一个包
- qt - 如何在我创建的 Qt Wayland 合成器中打开像 firefox 这样的 gui 应用程序
- ios - 在 Swift 的主项目中使用私有 pod 中的可本地化文件
- gitlab-ci - GitLab CI 脚本中的重启机器
- scheme - 卫生宏扩展器必须了解哪些Scheme特殊形式?