Skip to content

pmOnFail does not default to 'download' with devEngines.packageManager #11676

@karlhorky

Description

@karlhorky

Reporting on behalf of @nene in sql-formatter-org/sql-formatter#949 (comment)

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

11.1.2

Which area(s) of pnpm are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

Original report from @nene: sql-formatter-org/sql-formatter#949 (comment)

Reproduction steps

Clone the sql-formatter PR branch switch-from-yarn-v1-to-pnpm-v11 (no config of pmOnFail in pnpm-workspace.yaml):

git clone --branch switch-from-yarn-v1-to-pnpm-v11 https://github.com/sql-formatter-org/sql-formatter.git
cd sql-formatter

Install pnpm@11.1.2 with Homebrew:

brew install pnpm

Run install with pnpm 11.1.2:

pnpm install

Reported result:

[ERROR] This project is configured to use 11.0.8+sha512.4c4097e1dd2d42372c4e7fa5a791ff28fc75a484c7ac192e64b1df0fdef17594ba982f9b4fed9adfb3c757846f565b799b2763fb3733d1de1bcb82cf46684912 of pnpm. Your current pnpm is v11.1.2
If you want to bypass this version check, you can set the "pmOnFail" configuration to "warn" or "ignore" (e.g. via --pm-on-fail=ignore). If using "devEngines.packageManager", you can set its "onFail" to "warn" or "ignore"

Installation succeds if pmOnFail of 'download' is set via flag:

pnpm install --pm-on-fail=download

Explicitly setting pmOnFail: download in pnpm-workspace.yaml config also succeeds.

Environment / Installation

pmOnFail is undefined:

$ pnpm config get pmOnFail
undefined

There are also no relevant environment variables set, including pnpm_config_pm_on_fail or COREPACK_*.

pnpm was installed with Homebrew:

brew install pnpm

Corepack is installed, but pnpm is not being invoked through a Corepack shim:

$ corepack --version
0.34.6

$ command -v pnpm
/opt/homebrew/bin/pnpm

$ ls -al "$(command -v pnpm)"
lrwxr-xr-x  1 nene  admin  30 May 14 22:26 /opt/homebrew/bin/pnpm@ -> ../Cellar/pnpm/11.1.2/bin/pnpm

Describe the Bug

pmOnFail is documented as defaulting to download.

However, in this project, pnpm install does not behave the same as pnpm install --pm-on-fail=download.

The project uses devEngines.packageManager to require pnpm 11.0.8+sha512.4c4097e1dd2d42372c4e7fa5a791ff28fc75a484c7ac192e64b1df0fdef17594ba982f9b4fed9adfb3c757846f565b799b2763fb3733d1de1bcb82cf46684912.

Reported behavior:

  1. pnpm install fails with a package manager version mismatch.
  2. pnpm install --pm-on-fail=download succeeds.
  3. Explicitly setting pmOnFail: download in config also succeeds.
  4. pnpm config get pmOnFail returns undefined when run from another directory, or when devEngines.packageManager is removed.

Expected Behavior

When pmOnFail is not explicitly configured, pnpm install should behave the same as pnpm install --pm-on-fail=download.

Which Node.js version are you using?

22.22.3

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions