cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] `npm prune --help` suggests non-existent commands

Open mareksapota opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

This issue exists in the latest npm version

  • [x] I am using the latest npm

Current Behavior

npm prune --help suggests the usage of npm help prune but that command doesn't exist.

Expected Behavior

Either for npm prune --help not to suggest to Run "npm help prune" for more info or for npm help prune to work and provide more info.

Steps To Reproduce

$ podman pull node:alpine
$ podman run --rm -it node:alpine /bin/sh
/ # npm prune --help
Remove extraneous packages

Usage:
npm prune [[<@scope>/]<pkg>...]

Options:
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
[--dry-run] [--json] [--foreground-scripts] [--ignore-scripts]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root] [--install-links]

Run "npm help prune" for more info
/ # npm help prune
npm error help process exited with code: ENOENT
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-02-05T02_21_32_290Z-debug-0.log
/ # cat /root/.npm/_logs/2025-02-05T02_21_32_290Z-debug-0.log
0 verbose cli /usr/local/bin/node /usr/local/bin/npm
1 info using [email protected]
2 info using [email protected]
3 silly config load:file:/usr/local/lib/node_modules/npm/npmrc
4 silly config load:file:/.npmrc
5 silly config load:file:/root/.npmrc
6 silly config load:file:/usr/local/etc/npmrc
7 verbose title npm help prune
8 verbose argv "help" "prune"
9 verbose logfile logs-max:10 dir:/root/.npm/_logs/2025-02-05T02_21_32_290Z-
10 verbose logfile /root/.npm/_logs/2025-02-05T02_21_32_290Z-debug-0.log
11 silly logfile done cleaning log files
12 verbose stack Error: help process exited with code: ENOENT
12 verbose stack     at Help.viewMan (/usr/local/lib/node_modules/npm/lib/commands/help.js:102:15)
12 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
12 verbose stack     at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:207:9)
12 verbose stack     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:74:5)
13 error help process exited with code: ENOENT
14 verbose cwd /
15 verbose os Linux 6.12.9-1-default
16 verbose node v23.7.0
17 verbose npm  v10.9.2
18 verbose exit 1
19 verbose code 1
20 error A complete log of this run can be found in: /root/.npm/_logs/2025-02-05T02_21_32_290Z-debug-0.log

Environment

  • npm: 10.9.2
  • Node.js: v23.7.0
  • OS Name: Alpine 3.21.2, https://hub.docker.com/layers/library/node/alpine/images/sha256-647402a42439b1cb71154fd5aada29d6561b6d5267ddf342095aa599e1bfc771
  • System Model Name: podman
  • npm config: n/a, default

mareksapota avatar Feb 05 '25 02:02 mareksapota

npm help prune works for me. It's possible that alpine has pruned the man page files and npm can't find them. This is not an npm bug.

I tested this both with a manually updated npm (i.e. npm -g npm@latest) and one that ships with Node.js (by installing node v23.7.0 which was previously not on my system). npm help prune works in both situations.

wraithgar avatar Feb 05 '25 15:02 wraithgar