nvm icon indicating copy to clipboard operation
nvm copied to clipboard

Corepack and Yarn isolation in an nvm-managed environment

Open marlondecol opened this issue 1 year ago • 2 comments

My system has only two versions of Node.js installed and managed by nvm: the default is 20, which I use for almost all of my projects; the other one is 16. There is no other version of Node.js on this system, regardless of how it is installed. Both only have Corepack and NPM installed globally, each at the latest supported version.

The issue I come to discuss is that Corepack does not activate Yarn in isolation, i.e., every time a certain version of Yarn is activated in one of the Node.js versions, it is also activated in the other version. Therefore, I cannot, for example, use the latest version of Yarn on Node.js 20, as it is not compatible with 16.

Is there a way to isolate Yarn or this is the way Corepack works?

I use nvm with Z shell in a macOS v14.5.

marlondecol avatar May 28 '24 16:05 marlondecol

That seems like the way corepack works - if it's not designed to do per-shell tool selection, then it won't work well with nvm's per-shell design.

You may want to file a corepack issue about it - it's still experimental.

ljharb avatar May 28 '24 16:05 ljharb

Okay, I'll do that. Thanks!

marlondecol avatar May 28 '24 16:05 marlondecol