Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: yarn set version berry installs the version 4 instead of 3? #5823

Closed
1 task
brunozoric opened this issue Oct 23, 2023 · 15 comments
Closed
1 task

[Bug?]: yarn set version berry installs the version 4 instead of 3? #5823

brunozoric opened this issue Oct 23, 2023 · 15 comments
Labels
bug Something isn't working not a bug

Comments

@brunozoric
Copy link

Self-service

  • I'd be willing to implement a fix

Describe the bug

When users install our project, we used to do the yarn set version berry, which installed the version 3 and now it tries to install the version 4. Our project is still on Node v16 (upgrade to v18 is in progress) and Yarn v4 is failing to install.

I tried all the commands from the docs and none of them can install the v3.

For example:

yarn set version https://repo.yarnpkg.com/3.6.4/packages/yarnpkg-cli/bin/yarn.js
Resolving https://repo.yarnpkg.com/3.6.4/packages/yarnpkg-cli/bin/yarn.js to a url...
error An unexpected error occurred: "Release not found: https://repo.yarnpkg.com/3.6.4/packages/yarnpkg-cli/bin/yarn.js".

Is there any other way to set the version to 3.x?

thanks

To reproduce

  1. Have Yarn v1 installed.
  2. Try to set version to v3.6.4: yarn set version https://repo.yarnpkg.com/3.6.4/packages/yarnpkg-cli/bin/yarn.js

Environment

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 16.20.0
    Yarn: 1.22.19
    npm: 9.8.1
  npmPackages:
    jest: ^29.5.0 => 29.5.0

Additional context

No response

@brunozoric brunozoric added the bug Something isn't working label Oct 23, 2023
@i4rilu
Copy link

i4rilu commented Oct 23, 2023

Slightly different, but related issue:

/tmp % yarn --version
1.22.19
/tmp % yarn set version 3.6.1
➤ YN0000: Done in 0s 4ms
/tmp % yarn --version
4.0.0
/tmp %

@wojtekmaj
Copy link
Contributor

Not directly addressing your report, but you may want to revisit the way you're installing Yarn in the first place. Perhaps use Corepack (as recommended) to get rid of Yarn v1 dependency altogether?

@brunozoric
Copy link
Author

brunozoric commented Oct 23, 2023

> node -v
v16.20.0
> corepack enable
> yarn set version 3.6.4
Usage Error: This tool requires a Node version compatible with >=18.12.0 (got 16.20.0). Upgrade Node, or set `YARN_IGNORE_NODE=1` in your environment.

No changes in the error.

@wojtekmaj
Copy link
Contributor

yarn set version 3.6.4

This command is ran by Yarn 4, hence the error. If your server stil runs Node 16, you upgraded Yarn to version 4 too fast.

But, if you really want to dig deeper into this workaround, try setting packageManager in package.json, so instead of yarn set version 3.6.4 run npm pkg set packageManager="[email protected]". This way, you won't use Yarn to downgrade Yarn.

@arcanis
Copy link
Member

arcanis commented Oct 23, 2023

As a stopgap, can you try setting export YARN_IGNORE_NODE=1 in your CI?

@arcanis arcanis changed the title [Bug?]: Set version from the repo url does not work [Bug?]: "This tool requires a Node version compatible" when running yarn set version Oct 23, 2023
@arcanis arcanis pinned this issue Oct 23, 2023
@brunozoric
Copy link
Author

@arcanis
I don't see how would that help me with the user projects.
I have a possible workaround, need to test it. I really dont want to use the v4 with the YARN_IGNORE_NODE flag, as I don't know the repercussions it would cause.

But still, its not good that you push v4 into the berry keyword.
When v2 came out, there was a part in the docs which said something like: berry will always be Yarn version 2. Then came v3 and it was berry, same with v4.

@arcanis

This comment was marked as off-topic.

@Piero87

This comment was marked as off-topic.

@arcanis
Copy link
Member

arcanis commented Oct 23, 2023

Actually I think I understand the confusion now - I got mistaken by @i4rilu's and @wojtekmaj's posts, I now see your initial problem was different from what I thought. Sorry about that.

The yarn set version berry command (and the berry selector) is an alias for stable, but we never intended to guarantee that it would be an alias for "2.x". As I mentioned "berry" is the name of the modern codebase, so its purpose was mostly to make clear that it would be different from 1.x (something that "stable" didn't properly convey at the time). Back in 2.x it was pointing to the latest stable 2.x release, then the latest 3.x release, etc. So this thread is "not a bug", it's expected that berry always points to the latest release.

However, running yarn set version 3.6.4 should work, but due to an actual bug (the one I mentioned in my previous message) it currently doesn't. I'm working on that, but for now I'm afraid there isn't a better option than the environment variable I mentioned (or to tell your users to install Yarn via Corepack). I hope to have it solved tomorrow or Wednesday.

@Piero87 this seems to be a different issue, please open a new thread (I already misunderstood the problem statement once, I want to be sure we don't get confused again).

@wojtekmaj

This comment was marked as off-topic.

@arcanis arcanis changed the title [Bug?]: "This tool requires a Node version compatible" when running yarn set version [Bug?]: yarn set version berry installs the version 4 instead of 3? Oct 23, 2023
@Piero87

This comment was marked as off-topic.

@arcanis
Copy link
Member

arcanis commented Oct 23, 2023

I opened a thread to consolidate information around the yarn set version bug at #5829. Closing this one as duplicate.

@arcanis arcanis closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2023
@rdewolff
Copy link

Thanks for the tip, helped me solved an issue while deploying on vercel

@bamf2077
Copy link

bamf2077 commented Dec 6, 2023

I think berry = latest = stable, just like this repository with the same name, represents the mainline development version of Yarn.

berry is not a code name of specific version like Node v20 LTS Iron, Debian 12 bookworm, Android 13 Tiramisu, so there is no Yarn v3 c*** or v4 d***.

@popuguytheparrot
Copy link

i have issue with not install 4 version

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working not a bug
Projects
None yet
Development

No branches or pull requests

9 participants