pnpm / pnpm/setup

Runtime version detection breaks when pnpm writes [WARN] to stdout

Open Beginner friendly
#57 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
140
Forks
19
Avg merge
13h 19m
Merged PRs (30d)
3

Description

What happens

Every job using pnpm/setup@v2.1.0 with a runtime to install gets a warning annotation:

Unable to determine the installed runtime versions: Unexpected token 'W', "[WARN] Usin"... is not valid JSON

The runtime itself installs fine — only the version refinement (and the cache key it feeds) falls back.

Why

getInstalledRuntimeVersions (src/install-runtime/index.ts) does:

const stdout = await runPnpmForOutput(binDest, ['list', '--global', '--json', '--depth', '0'])
const listing = JSON.parse(stdout)

pnpm 12 writes a warning to stdout, ahead of the JSON, when the project configures pmOnFail:

[WARN] Using --global skips the package manager check for this project

so JSON.parse sees [WARN] Usin....

Repro (pnpm 12.4.1)
mkdir repro && cd repro
printf '{"name":"t","version":"1.0.0"}' > package.json
printf 'pmOnFail: warn\n' > pnpm-workspace.yaml   # `error` does it too; removing the key does not
pnpm list --global --json --depth 0 | head -1
# [WARN] Using --global skips the package manager check for this project
Suggested fix

pnpm list --reporter=silent --global --json --depth 0 returns clean JSON in the same repro. Alternatively, slice from the first [ before parsing, so any future stdout noise is tolerated — the comment above the function already says this path must never break setup.

Happy to send a PR if you'd like.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/install-runtime/index.ts at getInstalledRuntimeVersions and reproduce with pnpm 12.4.1 using the commands in the issue. Verify the change handles warning-prefixed output, preserves runtime version refinement and its cache-key behavior, and continues to work with clean JSON.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ci-cd
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.