Verify latest 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
- Add a
package.json script that outputs something to stdout.
- Set
verifyDepsBeforeRun to install. (In pnpm v11 this is the default so we do not need to explicitly set it.)
- 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
- Run the script with either
pnpm --silent my-script or pnpm run --silent my-script
- 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?
If your OS is a Linux based, which one it is? (Include the version if relevant)
No response
Verify latest 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
package.jsonscript that outputs something to stdout.verifyDepsBeforeRuntoinstall. (In pnpm v11 this is the default so we do not need to explicitly set it.)package.jsonnode_modules/.pnpm-workspace-state-v1.jsonpnpm --silent my-scriptorpnpm run --silent my-scriptDescribe the Bug
When
verifyDepsBeforeRunisinstalland deps need verifying, pnpm will print data to stdout when running a script even when using the--silentoption. This can break shell scripts that use the output of apackage.jsonscript.Expected Behavior
When a script is run with the
--silentoption, 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: installshould probably do the same when an install fails.Which Node.js version are you using?
26.1.0
Which operating systems have you used?
If your OS is a Linux based, which one it is? (Include the version if relevant)
No response