Files
pnpm/cli/default-reporter
Zoltan Kochan 55de4febeb fix: render peer dependency issues on strict error (#11450)
Fixes #11439.

When `strictPeerDependencies: true` causes `ERR_PNPM_PEER_DEP_ISSUES`, the peer dependency issues are again rendered inline — using the **same format as `pnpm peers check`** — so users (and CI tools like Renovate) can see what failed without running another command.

The non-strict warning path is unchanged: it still emits the short "Run `pnpm peers check`" hint.

### Behavior

`strictPeerDependencies: true`:
```
 ERR_PNPM_PEER_DEP_ISSUES  Unmet peer dependencies

✕ unmet peer react
  Installed: 17.0.2
  Wanted:
    ^18.2.0:
      react-dom@18.2.0
hint: To disable failing on peer dependency issues, add the following to pnpm-workspace.yaml in your project root:

  strictPeerDependencies: false
```

`strictPeerDependencies: false` (unchanged):
```
 WARN  Issues with peer dependencies found. Run "pnpm peers check" to list them.
```

### Implementation

- Added a new `@pnpm/deps.inspection.peers-issues-renderer` package at `deps/inspection/peers-issues-renderer/`, alongside its data producer `@pnpm/deps.inspection.peers-checker`. It exposes a single `renderPeerIssues()` that emits the flat issue list previously inlined in `pnpm peers check`.
- Removed the duplicated formatter from `deps/inspection/commands/src/peers.ts` and made the `pnpm peers check` command consume the new renderer.
- `cli/default-reporter/src/reportError.ts`: `reportPeerDependencyIssuesError` now calls the shared `renderPeerIssues()` and prefixes the hint block with the rendered output. Tests strip ANSI escapes before substring assertions so they stay correct under `FORCE_COLOR=1`.

Result: a single renderer is shared between the install error and the `pnpm peers check` command — output is identical between the two paths.
2026-05-04 19:44:30 +02:00
..
2026-05-03 01:24:22 +02:00

@pnpm/cli.default-reporter

The default reporter of pnpm

Installation

pnpm add @pnpm/cli.default-reporter

Usage

import { streamParser } from '@pnpm/logger'
import { initDefaultReporter } from '@pnpm/cli.default-reporter'

const stopReporting = initDefaultReporter({
  context: {
    argv: [],
  },
  streamParser,
})

try {
  // calling some pnpm APIs
} finally {
  stopReporting()
}

Style Guide

  1. Never use blue or grey as font color as they are hard to read in many consoles.
    1. Use dim instead of grey
    2. Use cyan bright instead of blue
  2. Don't hide the CLI cursor. (It is easier to never hide but it is really needed only when scripts are running.)
  3. Don't use green and yellow to distinct something.

License

MIT