Skip to content

[BUG] Subcommand usage errors show the wrong command path (e.g. "npm approve" instead of "npm stage approve") #9403

@shaanmajid

Description

@shaanmajid

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

Current Behavior

Running a subcommand without its required argument renders the usage error with the bare subcommand name instead of the full parent path. For example, npm stage approve (with no <stage-id>) prints:

npm error Missing required <stage-id>
npm error
npm error Approve a staged package, publishing it to the npm registry
npm error
npm error Usage:
npm error npm approve <stage-id>

Neither npm approve nor npm help approve exists, so following the message fails. The same applies to other npm stage/npm trust subcommands. npm stage approve --help already renders correctly; only the runtime usage error is wrong.

Expected Behavior

The error should reference the real command and help page:

npm error Usage:
npm error npm stage approve <stage-id>
...
npm error Run "npm help stage" for more info

Steps To Reproduce

  1. Run npm stage approve (omit the <stage-id>).
  2. Observe the EUSAGE usage block.
  3. It points to npm approve / npm help approve, neither of which exists.

Environment

  • npm: 11.15.0
  • Node.js: v26.0.0
  • OS Name: MacOS 26.4
  • System Model Name: N/A
  • npm config:
//registry.npmjs.org/:_authToken = (protected)
ignore-scripts = true
min-release-age = 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixing

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions