# Behavior ## Current behavior ``` $ npm help exec No matches in help for: exec $ npm help no-install No matches in help for: no-install ``` ## Expect behavior ``` $ npm help exec (`man npm-exec` spawns) $ npm help no-install Top hits for "no-install" ———————————————————————————— npm help exec no-install:1 npm help npx no-install:1 ———————————————————————————— (run with -l or --long to see more context) ``` # Analysis The first help command looks for help info on a specific command while the second performs a full-text search in its help system. ## Why doesn't `npm --help exec` work in Gentoo? (man) npm searches for the `"npm-exec"` man file inside `/usr/lib64/node_modules/npm/man` which doesn't exist in Gentoo. Reference: https://github.com/npm/cli/blob/latest/lib/commands/help.js#L66 In Gentoo, npm's man pages are installed in `/usr/share/man` . This issue was reported in b.g.o before (https://bugs.gentoo.org/682062) and was closed due to inactivity. ## Why doesn't `npm --help no-install` work in Gentoo? (apropos-like) Once the man-page search fails, npm does a full text search in all *.md files inside `/usr/lib64/node_modules/npm/docs/content` . Reference: https://github.com/npm/cli/blob/latest/lib/commands/help-search.js#L20-L21 However, all *.md files in node_modules are deliberately deleted during `src_install`. Reference: https://github.com/gentoo/gentoo/blob/master/net-libs/nodejs/nodejs-22.15.0.ebuild#L241 # My attempts to fix 1. Symlink all npm's man pages into `/usr/lib64/node_modules/npm/man` Symlinking /usr/share/man may cause `npm --help ls` spwaning `man ls` as talked in bug 682062. 2. Retain all *.md files from `docs/content` and instead remove *.md in `"${LIBDIR}"/node_modules/npm/node_modules` I'd like to submit a PR if my solution is acceptable or once an initial solution is established. (need some time due to compiling nodejs on my machine is time-consuming)