Skip to content

Pin version of pnpm used in a project #3638

@petermikitsh

Description

@petermikitsh

Describe the user story

As a developer working on a team project, I want to ensure all team members use the same version of pnpm to avoid subtle or hard-to-debug issues.

Describe the solution you'd like

Something akin to Yarn's yarn policies set-version (documented here: https://classic.yarnpkg.com/en/docs/cli/policies/#toc-policies-set-version).

Key behaviors:

  • pnpm is checked into the repository
  • A configuration change is checked in, identifying the path. Example .yarnrc:
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


yarn-path ".yarn/releases/yarn-1.18.0.cjs"

Describe the drawbacks of your solution

Committing dependencies is usually discouraged, but I've found checking the package manager into the repository to provide more value than without it, particularly on large/complex projects. This is an opt-in feature that developers don't have to use.

Describe alternatives you've considered

Document the appropriate version in package.json, but this still relies on teammates having the appropriate version installed globally.

Per the package.json docs:

During local development, pnpm will always fail with an error message if its version does not match the one specified in the engines field.

Checking in simplifies the workflow of seeing the error message and having to manually correct it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions