Bug: corepack ignores COREPACK_NPM_REGISTRY for yarnpkg registry
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- node.js, typescript
- 领域
- tooling
调研方向
从 config.json 以及 sources/corepackUtils.ts 和 sources/npmRegistryUtils.ts 中处理 registry 的代码开始,尤其关注引用的行。追踪 COREPACK_NPM_REGISTRY 如何应用于 npmjs.org,以及为什么它不涵盖 registry.yarnpkg.com。当 Corepack 能够一致地使用为 Yarn registry 配置的代理,并且受支持的配置行为得到明确确立时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Conditions for bug
npmjs.org and yarnpkg.com are blocked on my laptop
Background and things I've tried
We have an internal registry mirror which mirrors both npmjs and yarnpkg. Due to a recent supply chain attack it is a policy that my laptop blocks both npmjs and yarnpkg so I'm not able to reach them directly. All of my JS RC files are set to reach out to corporate proxy:
~/.npmrc~/.yarnrc~/.yarnrc.yml
I learned that corepack ignores all of these files and instead reaches out to registries directly. I was able to partially work around this by setting the following environment variable.
export COREPACK_NPM_REGISTRY="<my corporate proxy>"
Setting this environment variable gets me past errors for registry.npmjs.org but still triggers errors for registry.yarnpkg.com.
Potentially buggy lines of code
- https://github.com/nodejs/corepack/blob/7e0758e4fd920859ad92adf204caf766b242f1af/config.json#L119
- https://github.com/nodejs/corepack/blob/7e0758e4fd920859ad92adf204caf766b242f1af/sources/corepackUtils.ts#L233-L256
- https://github.com/nodejs/corepack/blob/7e0758e4fd920859ad92adf204caf766b242f1af/sources/npmRegistryUtils.ts#L14
Because https://registry.yarnpkg.com does not match https://registry.npmjs.org there's no proxying available.
Desired solution
- Ideally: adhere to
~/.yarnrc.yml - Or adhere to
COREPACK_NPM_REGISTRY - Or introduce a new environment variable
COREPACK_YARN_REGISTRY - Or more robust environment variable which allows one to substitute multiple registries via some kind of expression syntax.
- 主要语言
- TypeScript
- 星标
- 3.8k
- 派生
- 281
- 平均合并
- 1 小时 47 分钟
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nodejs/corepack 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 4/5 3-5 天 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 52/100
-
难度 3/5 1-2 天 新手友好度 68/100
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 68/100
aiko-chan-ai/DiscordBotClient#380 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
vercel/ai-elements#507 ·
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 2 天内回复
-
难度 2/5 半天 新手友好度 84/100
anaclumos/qa-interns#148 · 1 条评论 ·
维护者通常 1 天内回复