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

Specify Version with corepack enable when using pnpm #49

Closed
ScottAwesome opened this issue Aug 28, 2021 · 1 comment
Closed

Specify Version with corepack enable when using pnpm #49

ScottAwesome opened this issue Aug 28, 2021 · 1 comment

Comments

@ScottAwesome
Copy link

ScottAwesome commented Aug 28, 2021

Corepack version: 0.9.0

Expected behavior: when using corepack enable expect to be able to tell it which version should be enabled, much like corepack use.

Actual behavior: corepack enable does not automatically download the latest version of the package manager in question by default. Which pnpm, it downloads 6.11.0 instead of 6.14.3 (latest as of the date of this post, 8/28/2021). It does not support the version string like corepack use does, e.g. corepack enable pnpm@latest is not supported.

This is not applicable to yarn, since yarn detects the version based on the .yarn directory and what version has been registered there.

EDIT: I know that you can do the following steps (which may be somewhat redudant here) to achieve this, I think it would be more straightforward (this was not obvious to me at least) if this was done by corepack enable in this scenario.

I was able to get it to use the latest version by doing the following:

  • run corepack prepare pnpm@6.14.3 -o ./
  • Then running corepack hydrate ./corepack.tgz --activate
  • Finally, running corepack enable pnpm

The steps above resulted in the latest pnpm being available.

If this is in fact the desired flow for using arbitrary versions, I'm happy to help document this flow

@merceyz
Copy link
Member

merceyz commented Aug 31, 2021

corepack enable is just supposed to enable the shims, not set specific versions. To change the global version you can run

corepack prepare pnpm@6.14.3 --activate

though keep in mind corepack is meant to be used with the packageManager field in package.json

@arcanis arcanis closed this as completed Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants