Skip to content

Add "packageManager" field in package.json for corepack #222330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zetavg
Copy link

@zetavg zetavg commented Jul 21, 2024

For developers with Corepack enabled, the "packageManager" field in package.json will be used by Corepack to automatically determine which version of the package manager should be used for the current project.

https://nodejs.org/docs/latest-v20.x/api/packages.html#packagemanager

Background

When developers with Corepack enabled run the yarn command, the "packageManager" field in the root package.json will be automatically added with the following message shown:

! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e.
! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager

1.22.22

...while this might not be ideal since it'll make the git working tree dirty.

For developers with [Corepack](https://nodejs.org/docs/latest-v20.x/api/corepack.html) enabled, the `"packageManager"` field in `package.json` will be used by Corepack to automatically determine which version of the package manager should be used for the current project.

https://nodejs.org/docs/latest-v20.x/api/packages.html#packagemanager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants