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?]: Install instructions install 1.x instead of 3.x+ #6274

Open
1 task
dylanh724 opened this issue May 5, 2024 · 6 comments
Open
1 task

[Bug?]: Install instructions install 1.x instead of 3.x+ #6274

dylanh724 opened this issue May 5, 2024 · 6 comments
Labels
bug Something isn't working waiting for feedback Will autoclose in a while unless more data are provided

Comments

@dylanh724
Copy link

Self-service

  • I'd be willing to implement a fix

Describe the bug

https://yarnpkg.com/getting-started/install

These instructions are the same as the classic instructions, more or less, resulting in v 1.22.11 (which isn't even the classic stable version)

To reproduce

With node 20.12.2 (lts):

  1. corepack enable
  2. yarn -v

Environment

> yarn dlx -q envinfo --preset jest

yarn run v1.22.11
warning package.json: No license field
error Command "dlx" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Additional context

The installation process to get to the correct latest stable version (3.x?) is wildly confusing with inaccurate best-practice installation steps. I tried to go to the Discord for help, but your website Discord link was also broken. Perhaps this hasn't been updated since 1.x?

@dylanh724 dylanh724 added the bug Something isn't working label May 5, 2024
@clemyan
Copy link
Member

clemyan commented May 5, 2024

resulting in v 1.22.11 (which isn't even the classic stable version)

This should not happen if Corepack is properly enabled unless

  • Your working directory is inside a project with a pinned yarn version
  • You somehow installed an old Corepack version

The Corepack version that comes with Node 20.12.2 should be Corepack 0.25.2, which default to yarn v1.22.21.

Check your PATH or use which yarn (or equivalent on your system) to make sure your yarn command is the shim generated by Corepack.

yarn dlx -q envinfo --preset jest

yarn run v1.22.11

Also should not happen if Corepack is properly enabled

@dylanh724
Copy link
Author

resulting in v 1.22.11 (which isn't even the classic stable version)

This should not happen if Corepack is properly enabled unless

  • Your working directory is inside a project with a pinned yarn version
  • You somehow installed an old Corepack version

The Corepack version that comes with Node 20.12.2 should be Corepack 0.25.2, which default to yarn v1.22.21.

Check your PATH or use which yarn (or equivalent on your system) to make sure your yarn command is the shim generated by Corepack.

yarn dlx -q envinfo --preset jest

yarn run v1.22.11

Also should not happen if Corepack is properly enabled

Hmm, please define "properly" - from my understanding, it's just 1 command (above)?

I'm on a fresh install of Win11, installed Node via nvm, installed node 20 and activated via nvm, then issues the corepack enable command.

Does yarn have known issues with nvm?

@clemyan
Copy link
Member

clemyan commented May 5, 2024

Looking at it again, I think the most likely scenario is you have a pinned version of yarn. Try yarn --version again. If it still shows v1.22.11, look for a package.json file and see if there is a packageManager field.


Let's try this then

  1. Make sure you are on the correct versions of Node and Corepack, and an unexpected version of Yarn
> node -v
v20.12.2
> corepack -v
0.25.2
> yarn -v
1.22.11
  1. Check where your yarn command points to. That would be where yarn for CMD or Get-Command yarn for PowerShell. Make sure that is in the same directory as your node command. If not then you have installed yarn outside of Corepack and that is interfering with Corepack.
> Get-Command yarn

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
ExternalScript  yarn.ps1                                                      C:\Program Files\nodejs\yarn.ps1

> Get-Command node

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     node.exe                                           20.12.2.0  C:\Program Files\nodejs\node.exe
  1. Run yarn config get yarnPath to check if you are inside a project with a pinned yarn binary. If that outputs a path then that is the pinned yarn binary.

@Gambitboy
Copy link

Gambitboy commented May 7, 2024

Not sure if its related but I'm having the reverse of this.

I opened an issue on the original repo

When I try install yarn v1 via NPM or Brew I get version 3.6.4

This is on a M1 Mac

@Gambitboy
Copy link

I fixed it by running the following command:

rm -rf ~/.yarn*

Suggested by someone on stackoverflow. Might be useful here.
https://stackoverflow.com/a/70978316/11701253

Not really sure how berry got installed on my machine as I've never used it before.

@dylanh724
Copy link
Author

Just on my phone, but I'll be able to test this soon -- perhaps in a few days. Cheers for advice.

@clemyan clemyan added the waiting for feedback Will autoclose in a while unless more data are provided label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for feedback Will autoclose in a while unless more data are provided
Projects
None yet
Development

No branches or pull requests

3 participants