Runtime version detection breaks when pnpm writes [WARN] to stdout
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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