nodejs / nodejs/corepack

`corepack prepare` with a range of versions is unexpected

Open
#177 0 comments 3 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

corepack prepare command with a range of versions behaves differently than expected.

Case 1

When:

  • yarn@3.2.3 is the latest published version
  • no local cache (In OSX, $HOME/.cache/node/corepack/yarn is empty)

Actually:

$ corepack prepare yarn@~3.2.0
Usage Error: Failed to successfully resolve '~3.2.0' to a valid yarn release

My expectation:
corepack installs yarn@3.2.3 in the local cache.

Case 2

When:

  • yarn@3.2.3 is the latest published version
  • Only yarn@3.2.1 is in the local cache

Actually:

$ corepack prepare yarn@~3.2.0
Preparing yarn@~3.2.0...

but no additional versions are installed.
There is nothing but yarn@3.2.1 in the local cache.

My expectation:
corepack installs yarn@3.2.3 in the local cache.

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 with the corepack prepare command and reproduce both reported cases: an empty cache and a cache containing yarn@3.2.1. Trace how the requested ~3.2.0 range is resolved and cached, then verify that the latest matching release is installed in both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.