Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Bug: corepack ignores COREPACK_NPM_REGISTRY for yarnpkg registry

未关闭
#753 1 条评论 15 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
领域
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

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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nodejs/corepack 的其他 Issue

查看 nodejs/corepack 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。