npm / npm/cli

[BUG] custom viewer ignored in npm help

Open Beginner friendly
#9,828 0 comments 0 reactions 0 assignees View on GitHub

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".

https://github.com/npm/cli/blob/278df04d3f25d391af3213a243bb9f89e1d11899/workspaces/config/lib/definitions/definitions.js#L2750-L2761

Steps To Reproduce
  1. npm config --global set viewer batman
  2. npm help exec
  3. 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

Open the contributing guide

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.