nodejs / nodejs/corepack

Switch automatically

Open
#782 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.8k
Forks
279
Avg merge
1h 47m
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading Corepack's current handling of project metadata and version selection, then investigate how devEngines is represented and whether switching on cd is within Corepack's scope. The requested behavior is automatic Node and npm selection before npm i; done means a documented, supported workflow that requires no per-repository steps after initial setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.