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

How to update/upgrade from older version? #166

Open
digeomel opened this issue Aug 23, 2022 · 4 comments
Open

How to update/upgrade from older version? #166

digeomel opened this issue Aug 23, 2022 · 4 comments

Comments

@digeomel
Copy link

I am using yarn 1.22.19 with node 14.19.1 (actually using nvm to be able to use multiple node versions, but I'm not sure this is important here). I assume yarn installed corepack 0.10.0, because I definitely didn't install it manually myself.
How can I upgrade to the latest version 0.13.0? Do I need to uninstall yarn first? I tried with npm and it fails with the following error:

npm WARN rm not removing /home/digeomel/.nvm/versions/node/v14.19.1/bin/yarn as it wasn't installed by /home/digeomel/.nvm/versions/node/v14.19.1/lib/node_modules/corepack
npm WARN rm not removing /home/digeomel/.nvm/versions/node/v14.19.1/bin/yarnpkg as it wasn't installed by /home/digeomel/.nvm/versions/node/v14.19.1/lib/node_modules/corepack
npm ERR! code EEXIST
npm ERR! path /home/digeomel/.nvm/versions/node/v14.19.1/bin/corepack
npm ERR! Refusing to delete /home/digeomel/.nvm/versions/node/v14.19.1/bin/corepack: ../lib/node_modules/corepack/dist/corepack.js symlink target is not controlled by npm /home/digeomel/.nvm/versions/node/v14.19.1/lib/node_modules/corepack
npm ERR! File exists: /home/digeomel/.nvm/versions/node/v14.19.1/bin/corepack
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

@aduh95
Copy link
Contributor

aduh95 commented Aug 25, 2022

I assume yarn installed corepack 0.10.0, because I definitely didn't install it manually myself.

It's most likely not Yarn that did that, nvm probably installed Corepack, Corepack 0.10.0 is bundled with Node.js v14.19.1.

I tried with npm and it fails with the following error:

What did you try exactly? It'd be helpful to see the command you used.

@digeomel
Copy link
Author

@aduh95 I think it's obvious, but here goes:

npm -g install [email protected]

@aduh95
Copy link
Contributor

aduh95 commented Aug 25, 2022

It seems that nvm has a install-latest-npm feature (https://github.com/nvm-sh/nvm#migrating-global-packages-while-installing), maybe that also upgrades Corepack (although I doubt it, Corepack is nowhere to be seen in their docmentation).
If that doesn't work, I think you would need to open an issue to nvm and/or install Node.js from a different source that lets you chose whether you want the vendored version of Corepack alongside it. FWIW waiting for the next non-security release of Node.js v14.x is also an option, as it will include an updated version of Corepack, but I don't know when that's going to happen.

@merceyz
Copy link
Member

merceyz commented Aug 25, 2022

As the npm error tells you, it refuses to overwrite something it didn't create, you can add the -f flag to force it.

npm -g -f install [email protected]

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