yarnpkg / yarnpkg/berry

[Bug?]: yarn set version berry adds the cjs and yarnPath

Open
#6,151 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
8.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Self-service
  • I'd be willing to implement a fix
Describe the bug

Following the migration guide and running yarn set version berry still adds the yarnPath in my .yarnrc.yml file while also downloading the cjs.

My expectation was that the cjs was not being added. In the release notes for yarn 4 its described that

Now that Corepack is shipped with both Node 18 and 20 we no longer need to rely on yarnPath, and as a result we updated our installation guide to reflect that. The yarn init -2 and yarn set version commands have been updated to favor updating the packageManager field when possible.
Corepack knows which package manager version to use thanks to the standard packageManager field in your package.json. This field will typically be set via one of yarn init -2, yarn set version x.y.z, or the more generic corepack use yarn@x.y.z.

To reproduce

Run yarn set version berry

Environment
System:
    OS: macOS 14.3
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 20.11.1 - /private/var/folders/js/46y7lvvd7nsb8w0ny71jt_6r0000gp/T/xfs-e44a5938/node
    Yarn: 4.1.0 - /private/var/folders/js/46y7lvvd7nsb8w0ny71jt_6r0000gp/T/xfs-e44a5938/yarn
    npm: 10.2.4 - /usr/local/bin/npm
Additional context

No response

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 running yarn set version berry and inspect the resulting .yarnrc.yml and package.json. Compare the output with the migration guide and release notes; done means the command uses the expected packageManager configuration without adding an unnecessary yarnPath or CJS file.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.