[BUG] custom viewer ignored in npm help
Open
Beginner friendly
Nobody has claimed this yet.
Bug
Needs Triage
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
This is not just a request to bump a dependency for a CVE
- This is not solely a request to bump a dependency for a CVE
Current Behavior
Config viewer is completely ignored, unless it's "browser" or "woman":
https://github.com/npm/cli/blob/278df04d3f25d391af3213a243bb9f89e1d11899/lib/commands/help.js#L90
Expected Behavior
According to the docs, viewer should be "the program to use to view help content".
Steps To Reproduce
npm config --global set viewer batmannpm help exec- batman is never invoked
Environment
- npm: 12.0.1
- Node.js: v26.5.1
- OS Name: Arch Linux
- System Model Name: x86_64
- npm config:
; "user" config from /home/marmis/.config/npm/npmrc
; cache = "/home/marmis/.cache/npm" ; overridden by env
ignore-scripts = true
; init-module = "/home/marmis/.config/npm/npm-init.js" ; overridden by env
logs-dir = "/home/marmis/.local/state/npm/logs"
min-release-age = 7
viewer = "batman"
; "env" config from environment
cache = "/home/marmis/.cache/npm"
init-module = "/home/marmis/.config/npm/npm-init.js"
userconfig = "/home/marmis/.config/npm/npmrc"
; node bin location = /usr/bin/node
; node version = v26.5.1
; npm local prefix = /home/marmis
; npm version = 12.0.1
; cwd = /home/marmis
; HOME = /home/marmis
; Run `npm config ls -l` to show all defaults.
Contributor guide
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 lib/commands/help.js at the linked handling around line 90, then compare it with the viewer definition in workspaces/config/lib/definitions/definitions.js. Reproduce with npm config --global set viewer batman and npm help exec; done means the configured custom viewer is invoked rather than ignored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100