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

Switch automatically

未关闭
#782 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
30/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
nodejs, typescript

调研方向

首先阅读 Corepack 当前处理项目元数据和版本选择的方式,然后调查 devEngines 的表示方式,以及在执行 cd 时进行切换是否属于 Corepack 的范围。所请求的行为是在 npm i 之前自动选择 Node 和 npm;完成的标准是提供一个有文档说明且受支持的工作流,在完成初始设置后无需针对每个 repository 执行任何步骤。

由索引模型根据 Issue 内容生成。

描述

Is there any way to make it so when I clone down a brand new repo that uses devEngines and cd into it, I'm automatically on the correct Node/npm version, via corepack. Example:

{
  "name": "my-project",
  "devEngines": {
    "runtime": {
      "name": "node",
      "version": ">= 24.0.0"
    },
    "packageManager": {
      "name": "npm",
      "version": "11.7.0"
    }
  }
}

I'm fine with a one time series of steps to install corepack and enable it or whatever, but I don't want to have to do any steps at all after that. I should be able to just git clone https://github.com/org/my-project.git && cd my-project && npm i && npm start and know that if that project uses a different version of Node or npm from what I have it will download it automatically and switch to it before doing the npm i.

This is fully possible with Volta (not with devEngines object, but a similar volta object in the package.json). But Volta is no longer maintained. Can Corepack be used as a replacement today, or would it be possible for it to add support for these features? Thanks.

主要语言
TypeScript
星标
3.8k
派生
279
平均合并
1 小时 47 分钟
30 天内合并 PR
2

贡献指南

打开贡献指南

从这里开始

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

nodejs/corepack 的其他 Issue

查看 nodejs/corepack 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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