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

Update Corepack instructions in installation.md #504

Merged
merged 2 commits into from
Jan 27, 2024
Merged

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Jan 24, 2024

The current instructions were a bit outdated, so I'm suggesting a few updates:

Copy link

stackblitz bot commented Jan 24, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

vercel bot commented Jan 24, 2024

@aduh95 is attempting to deploy a commit to the pnpm Team on Vercel.

A member of the Team first needs to authorize it.

docs/installation.md Outdated Show resolved Hide resolved
Co-authored-by: Zoltan Kochan <z@kochan.io>

```
corepack prepare pnpm@<version> --activate
Copy link
Member

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?

Copy link
Contributor Author

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).

Copy link
Member

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.

Copy link
Contributor Author

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.

@zkochan zkochan merged commit bd8a6be into pnpm:main Jan 27, 2024
1 of 2 checks passed
@aduh95 aduh95 deleted the patch-4 branch January 27, 2024 16:12
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

Successfully merging this pull request may close these issues.

2 participants