You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something happened that caused the binary to be overwritten. It's not possible to say what for certain with the info you have, but Corepack doesn't remove them by itself, so it points to a third-party issue.
Some Node.js version managers in particular are known to forget the Corepack status when switching between Node versions. Given you use nvm, it's likely what happened here.
Also try echo $PATH or echo %PATH% which will show you the precedence of which directories are searched on your machine. As mentioned above, likely nvm path is prepended in front of the corepack path which is causing it to prefer nvm.
The path is good, it's the same as it was when the bug was present.
which pnpm
~/.nvm/versions/node/v16.17.1/bin/pnpm
I definitely haven't done anything with global packages. What I have done though is I removed some of my cache folders after migrating to pnpm. What does corepack enable do exactly? Could I have broken it by deleting my cache folders?
I would like to add that the corepack looks for the packageManager property in package.json, Just make sure to update that as well to the latest version.
I was facing the same issue and it turns our my problem was due to the package.json configuration. I ran this command
$ corepack prepare pnpm@8.6.1 --activate
Preparing pnpm@8.6.1 for immediate activation...
Despite the command and its output, corepack actually installs pnpm@7.1.8 because that's what's specified in package.json.
This is very confusing behavior. I would consider it more intuitive for corepack to always install an explicitly-given version, and maybe output a warning if the version in package.json does not match.
I think #291 has addressed this, you can now use corepack use … and corepack up (and skip the corepack prepare command). Closing, let me know if I missed something.
Activity
merceyz commentedon Jan 3, 2023
Have you run
corepack enable? Your reproduction is missing it;vs
hyperknot commentedon Jan 3, 2023
Yes, I've done corepack enable the first time I installed it, otherwise I wouldn't have been able to use pnpm.
But now, I've run it again, just for testing and after that I'm able to do the upgrade.
So the bug report is basically this: To update pnpm, I need to repeatedly run
corepack enable, before each update.arcanis commentedon Jan 3, 2023
Something happened that caused the binary to be overwritten. It's not possible to say what for certain with the info you have, but Corepack doesn't remove them by itself, so it points to a third-party issue.
Some Node.js version managers in particular are known to forget the Corepack status when switching between Node versions. Given you use nvm, it's likely what happened here.
styfle commentedon Jan 3, 2023
Also try
echo $PATHorecho %PATH%which will show you the precedence of which directories are searched on your machine. As mentioned above, likely nvm path is prepended in front of the corepack path which is causing it to prefer nvm.hyperknot commentedon Jan 3, 2023
The path is good, it's the same as it was when the bug was present.
I definitely haven't done anything with global packages. What I have done though is I removed some of my cache folders after migrating to pnpm. What does
corepack enabledo exactly? Could I have broken it by deleting my cache folders?aduh95 commentedon Feb 24, 2023
It adds the binaries to your path, next to the
nodeone:corepack/README.md
Lines 128 to 138 in 5633a15
If you're using nvm, I'm not sure how this works as I believe it exposes different
nodebinary depending on the context.What cache folders?
hyperknot commentedon Feb 27, 2023
Just the npm, yarn, etc. cache folders I found under home dir and Library.
mrhammadasif commentedon May 9, 2023
I would like to add that the
corepacklooks for thepackageManagerproperty in package.json, Just make sure to update that as well to the latest version.iapetos163 commentedon Jun 10, 2023
I was facing the same issue and it turns our my problem was due to the
package.jsonconfiguration. I ran this commandDespite the command and its output, corepack actually installs
pnpm@7.1.8because that's what's specified inpackage.json.This is very confusing behavior. I would consider it more intuitive for corepack to always install an explicitly-given version, and maybe output a warning if the version in
package.jsondoes not match.aduh95 commentedon Feb 21, 2024
I think #291 has addressed this, you can now use
corepack use …andcorepack up(and skip thecorepack preparecommand). Closing, let me know if I missed something.