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

docs: caveats of multiple package managers #640

Open
jpbnetley opened this issue Feb 14, 2025 · 2 comments · May be fixed by #641
Open

docs: caveats of multiple package managers #640

jpbnetley opened this issue Feb 14, 2025 · 2 comments · May be fixed by #641

Comments

@jpbnetley
Copy link

I had an issue where pnpm was installed with corepack, but I would have a version mismatch when comparing the package manager in the package.json and the pnpm version in the terminal.

I created an issue with corepack: nodejs/corepack#659

After some debugging, we determined that I had 2 versions of pnpm installed.
One via corepack, and another via globally from npm.

See here as reference: nodejs/corepack#659 (comment)

I was then suggested to maybe add documentation to warn against this odd behaviour here: nodejs/corepack#659 (comment)

I am considering adding some information regarding this here: https://github.com/pnpm/pnpm.io/blob/main/docs/installation.md
on line 97.

:::warning

Having multiple package manager versions installed can cause an incorrect version of a package manager being used, regardless of the version that is specified in the package.json.

To verify there are not multiple version installed, see this [corepack issue 659](https://github.com/nodejs/corepack/issues/659#issuecomment-2658982866).

:::
jpbnetley added a commit to jpbnetley/pnpm.io that referenced this issue Feb 14, 2025
document potential issue when multiple versions of pnpm are installed while using corepack

closes pnpm#640
@zkochan
Copy link
Member

zkochan commented Feb 17, 2025

You had pnpm v9 installed. With pnpm v10 you wouldn't have noticed any issue as it would switch to the right pnpm version automatically. So, I don't think a notice is needed.

@jpbnetley
Copy link
Author

For me that is where the confusion came in.
Because the package.json specified v10.
And I happen to have a pnpm version installed with corepack and globally.
It would always use v9, even though the package json specified v10.
(as we discovered here: nodejs/corepack#659 (comment))
For me, that was confusing.

I think in my case what caused this confusion is corepack could not install the new version after throwing a key id mismatch error. (see nodejs/corepack#612 for more info)
And one of the suggested fixes was to install pnpm globally: nodejs/corepack#612 (comment)

Eventually I noticed the version miss match and didn't understand why the version specified in the package.json was not used.

But if you think the info is redundant, I can close the issue and docs pr.
Let me know.

Thank you for taking the time to go through the issue :)

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 a pull request may close this issue.

2 participants