-
Notifications
You must be signed in to change notification settings - Fork 508
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
Update Corepack instructions in installation.md
#504
Conversation
Run & review this pull request in StackBlitz Codeflow. |
@aduh95 is attempting to deploy a commit to the pnpm Team on Vercel. A member of the Team first needs to authorize it. |
Co-authored-by: Zoltan Kochan <z@kochan.io>
|
||
``` | ||
corepack prepare pnpm@<version> --activate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if I don't want to use the packageManager
field just install the latest pnpm version globally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should expect Corepack to download the latest version on the first use. After that, if you want to manually bump it, you can run corepack install --global pnpm@latest
(or the old corepack prepare
command, that still works).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So corepack enable pnpm
installs the latest version? It used to install some hardcoded stable version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The short answer is "yes". The long answer is:
Technically, corepack enable pnpm
only adds a binary on the PATH; pnpm will be downloaded only when it's first needed (so either when calling corepack pnpm …
or using the pnpm
bin created by corepack enable
), and here are the steps that Corepack takes to determine what version to use:
- if there's a local
package.json
with a"packageManager"
field, use the version defined there. - otherwise, check if there's a cached global version, if so, use that.
- otherwise, check if env variable
COREPACK_DEFAULT_TO_LATEST
was set to 0, in which case, use the hard coded version. - otherwise, use the latest version from the npm registry.
It did use to default to the hardcoded version, but that was a while back.
The current instructions were a bit outdated, so I'm suggesting a few updates:
corepack enable
currently also installs Yarn. It might make sense to restrict it to pnpm.corepack use
.