corepack icon indicating copy to clipboard operation
corepack copied to clipboard

global install of Corepack should not enable Corepack

Open MikeMcC399 opened this issue 8 months ago • 1 comments

What would you like?

When Corepack is installed from the npm registry with

npm install -g corepack

then Corepack should not be automatically enabled for pnpm and Yarn.

Why is this needed?

In a situation where Corepack is needed for Yarn and not wanted for pnpm, automatically enabling Corepack for pnpm breaks local workflows that expect pnpm to have been installed with npm install -g pnpm. Installing Corepack overrides this. Due to https://github.com/nodejs/corepack/issues/112 it is not possible to simply execute corepack disable pnpm because Corepack does not restore the original state.

MikeMcC399 avatar Apr 08 '25 05:04 MikeMcC399

This is more of a problem for locally working with Corepack since the settings persist between projects.

In CI environments, jobs are generally isolated from each other, so it is less likely to have a mixture of Yarn and pnpm in the same CI job.

Possibly Corepack could be set up to be enabled by default in CI only and / or this could be influenced by a new COREPACK environment variable.

MikeMcC399 avatar Apr 08 '25 09:04 MikeMcC399

Closing, as with the release of Node.js 25.0.0, changing the behavior could be disruptive.

MikeMcC399 avatar Oct 15 '25 19:10 MikeMcC399