Skip to content

Corepack not adding packageManager field to package.json  #560

@ProchaLu

Description

@ProchaLu

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:

  1. brew install node@20
  2. brew link --overwrite node@20
  3. corepack enable
  4. corepack prepare pnpm@latest --activate
  5. pnpm setup
  6. mkdir test
  7. cd test
  8. pnpm init
  9. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions