Skip to content
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

ERR_PNPM_PEER_DEP_ISSUES  should be written to stderr #5419

Open
raineorshine opened this issue Sep 28, 2022 · 1 comment
Open

ERR_PNPM_PEER_DEP_ISSUES  should be written to stderr #5419

raineorshine opened this issue Sep 28, 2022 · 1 comment

Comments

@raineorshine
Copy link

raineorshine commented Sep 28, 2022

pnpm version:

v7.12.0

Code to reproduce the issue:

git clone https://github.com/raineorshine/nest-api-example
cd nest-api-example
pnpm install
npx npm-check-updates -u
node spawn-pnpm-test.js

Note that spawn-pnpm-test.js simply spawns pnpm install and makes it clear what is written to stdout and what is written to stderr:

const spawn = require('child_process').spawn;
const child = spawn('pnpm', ['install'], {
  cwd: '/Users/raine/projects/nest-api-example',
});
let stderr = '';
let stdout = '';

child.stdout.on('data', (data) => (stdout += data));
child.stderr.on('data', (data) => (stderr += data));
child.on('close', (code) => {
  console.info('Return code', code);
  console.error('STDERR:', stderr);
  console.log('STDOUT:', stdout);
});

Expected behavior:

Errors should be written stderr.

Actual behavior:

Error code is non-zero, but errors are written to stdout instead of stderr.

Additional information:

  • node -v prints: v16.15.1
  • Windows, macOS, or Linux?: OSX 12.4

Note: The particular error used to demonstrate this issue only occurs the first time pnpm install is run. The second time pnpm install runs there is no error. However if you reset the test case and follow the steps above it will reproduce it.

@stefan-toubia
Copy link

This looks like it's not specific to pnpm install or ERR_PNPM_PEER_DEP_ISSUES, for some reason pnpm prints all output to stdout (or stderr if you're using the --use-stderr option). Most CLI tools don't work this way, usually informational text, warnings and errors are printed out to stderr.

For most CLI tools you would expect this to suppress all non-error output but still print errors, but this unfortunately doesn't work with pnpm since all output is being written to stdout.

 pnpm i >/dev/null

Shouldn't pnpm be outputting errors to stderr by default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants