Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 956307 - net-libs/nodejs: npm help and help-search doesn't work (missing man and .md files)
Summary: net-libs/nodejs: npm help and help-search doesn't work (missing man and .md f...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal minor
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-19 08:41 UTC by Xiami
Modified: 2025-05-19 16:34 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xiami 2025-05-19 08:41:00 UTC
# 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)