When using Homebrew to install Node.js, enabling Corepack, and then using Corepack to manage pnpm, Corepack does not add a packageManager field to my package.json. This field should be automatically added, but it is missing, requiring me to add it manually.
Setting the COREPACK_ENABLE_AUTO_PIN=1 in zshrc does not resolve the issue. Even after reinstalling Corepack and Node.js, the problem still exists.
Steps to Reproduce:
brew install node@20
brew link --overwrite node@20
corepack enable
corepack prepare pnpm@latest --activate
pnpm setup
mkdir test
cd test
pnpm init
corepack use pnpm@latest or pnpm install
Expected Behavior
Corepack should automatically add the packageManager field to package.json when using pnpm.
Actual Behavior
The packageManager field is not added, and setting COREPACK_ENABLE_AUTO_PIN=1 in ~/.zshrc does not fix the issue. Reinstalling Corepack and Node.js does not resolve the problem either.
Additional Information
Node.js v20.17.0
Corepack 0.29.3
pnpm 9.10.0
How can I set the environment variable to enable this functionality, and are there any other steps to resolve this issue?
When using Homebrew to install Node.js, enabling Corepack, and then using Corepack to manage pnpm, Corepack does not add a
packageManagerfield to my package.json. This field should be automatically added, but it is missing, requiring me to add it manually.Setting the
COREPACK_ENABLE_AUTO_PIN=1inzshrcdoes not resolve the issue. Even after reinstalling Corepack and Node.js, the problem still exists.Steps to Reproduce:
brew install node@20brew link --overwrite node@20corepack enablecorepack prepare pnpm@latest --activatepnpm setupmkdir testcd testpnpm initcorepack use pnpm@latestorpnpm installExpected Behavior
Corepack should automatically add the
packageManagerfield to package.json when using pnpm.Actual Behavior
The
packageManagerfield is not added, and settingCOREPACK_ENABLE_AUTO_PIN=1in~/.zshrcdoes not fix the issue. Reinstalling Corepack and Node.js does not resolve the problem either.Additional Information
Node.js v20.17.0
Corepack 0.29.3
pnpm 9.10.0
How can I set the environment variable to enable this functionality, and are there any other steps to resolve this issue?