Skip to content

verifyDepsBeforeRun: install does not respect the --silent option #11636

@joshuatshaffer

Description

@joshuatshaffer

Verify latest release

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

pnpm version

No response

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

CLI

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

https://github.com/joshuatshaffer/pnpm-silent-verify-deps-before-run-minimal-reproduction

Reproduction steps

  1. Add a package.json script that outputs something to stdout.
  2. Set verifyDepsBeforeRun to install. (In pnpm v11 this is the default so we do not need to explicitly set it.)
  3. Trigger dependency validation. Some ways to do this are:
    • Manually changing a dependency in package.json
    • Switching to a branch with different dependencies
    • Deleting node_modules/.pnpm-workspace-state-v1.json
  4. Run the script with either pnpm --silent my-script or pnpm run --silent my-script
  5. Note that pnpm adds data to stdout.

Describe the Bug

When verifyDepsBeforeRun is install and deps need verifying, pnpm will print data to stdout when running a script even when using the --silent option. This can break shell scripts that use the output of a package.json script.

Expected Behavior

When a script is run with the --silent option, pnpm should never output anything the user-defined script does not output. Said another way, the final stdout should be exactly equal to the script's internal stdout.

Stderr is not a concern for my use-case, but with verifyDepsBeforeRun: error, stderr is empty and an exit code is set. Therefore, verifyDepsBeforeRun: install should probably do the same when an install fails.

Which Node.js version are you using?

26.1.0

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