In Node.js, when corepack
is enabled, any yarn
, pnpm
or npm
command will auto-set packageManager
field in package.json
.
This is a breaking change for some projects, since having packageManager
means you can't use one packager for the install (npm i
) and another packager for running scripts (yarn start
). It would output the following error:
UsageError: This project is configured to use npm because ./package.json has a "packageManager" field
How to disable this behaviour? I'd like to keep using corepack, since it's nice, but I'd prefer to avoid setting a particular packageManager
in my package.json
.
Cheers.
You can set the environment variable COREPACK_ENABLE_AUTO_PIN
to 0
in order to disable this behavior (from corepack readme).