FS#69969 - [npm] "npm help" subcommand is broken in npm 7 Arch package

Attached to Project: Community Packages
Opened by D (DeeDeeG) - Saturday, 13 March 2021, 01:11 GMT
Last edited by Daniel M. Capella (polyzen) - Sunday, 30 April 2023, 04:24 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Felix Yan (felixonmars)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No



There is a subcommand of npm: "npm help".

(Usage: `npm help [npm subcommand here]`. For example: `npm help ci`.)

On Linux/macOS, `npm help` can show the manpage for any npm subcommand.

This is not working in the Arch package, but it's working in npm directly from the npm package registry.

Additional info:

* package version(s): npm 7.6.3-1, Node 15.11.0-1
* link to upstream bug report: https://github.com/npm/cli/issues/2857

(It was determined that this was an Arch packaging bug, not an upstream bug, since it's fully working everywhere outside of the custom Arch package.)

Steps to reproduce:

- With npm from the Arch package, do `npm help ci`.


Manpage for "npm-ci" is shown.


$ npm help ci
Top hits for "ci"
npm help package-json ci:76
npm help install ci:73
npm help config ci:62
npm help package-lock-json ci:24
npm help exec ci:17
npm help scripts ci:16
npm help npx ci:15
npm help update ci:14
npm help ls ci:13
npm help ci ci:13
(run with -l or --long to see more context)

Did you mean this?

- Counter-example: Working npm directly from the npm package registry:

- mkdir get_npm_as_modules && cd get_npm_as_module
- npm install npm@7
- npx npm help ci



npm-ci - Install a project with a clean slate

npm ci

[ . . . ]
This task depends upon

Closed by  Daniel M. Capella (polyzen)
Sunday, 30 April 2023, 04:24 GMT
Reason for closing:  Fixed
Additional comments about closing:  8.19.2-2. Thanks Nick!
Comment by Eli Schwartz (eschwartz) - Sunday, 14 March 2021, 01:32 GMT
I peeked at this a while ago. We move the manpages to the system man directory, so 'man npm-ci' works but using 'npm help ci' does not -- it tries to find its private manual page and fails.

The git program also provides manual pages and a 'git help subcommand' or 'git subcommand --help', but does so by invoking the system man command and assuming the manual can be found.

I tried hacking the npm source code to use the system manual directory but it wasn't very performant doing its own slow directory search traversal. :/
Comment by Szunti (Szunti) - Saturday, 04 September 2021, 15:10 GMT
Please revert moving the manpages if it ends up breaking npm.
If system-wide man pages are important, an upstream request could be made first. I would do it, but I always use 'git help', and don't see the benefits personally.
Comment by Nick Hanley (njhanley) - Saturday, 18 September 2021, 21:28 GMT
I second reverting the manpage move. Breaking 'npm help' is confusing as npm directly refers to it in usage messages and it isn't obvious that man can be used instead.
Comment by Nick Hanley (njhanley) - Monday, 06 March 2023, 01:20 GMT
I was reminded of this issue today and took another look at the PKGBUILD. Is there any reason not to symlink the npm man pages into the system directory? Attached is a patch that appears to work fine on my machine.