Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm help config fails with "Cannot read property '1' of null" #4610

Closed
2 tasks done
d0sboots opened this issue Mar 24, 2022 · 0 comments · Fixed by #4611
Closed
2 tasks done

[BUG] npm help config fails with "Cannot read property '1' of null" #4610

d0sboots opened this issue Mar 24, 2022 · 0 comments · Fixed by #4611
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@d0sboots
Copy link
Contributor

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

Here's the relevant error:

29 verbose stack TypeError: Cannot read property '1' of null
29 verbose stack at /nobackup/usr/share/nodejs/npm/lib/commands/help.js:65:49
29 verbose stack at Array.sort ()
29 verbose stack at Help.exec (/nobackup/usr/share/nodejs/npm/lib/commands/help.js:63:17)
29 verbose stack at async module.exports (/nobackup/usr/share/nodejs/npm/lib/cli.js:66:5)

The full log, slightly scrubbed for privacy:

0 verbose cli [ '/nobackup/usr/bin/node', '/usr/bin/npm', 'help', 'config' ]
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/nobackup/usr/share/nodejs/npm/npmrc Completed in 5ms
6 timing config:load:builtin Completed in 5ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/home/davedude/public_html/ConjunctionJunction/.npmrc Completed in 1ms
10 timing config:load:project Completed in 5ms
11 timing config:load:file:/home/davedude/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 15ms
19 timing npm:load:configload Completed in 16ms
20 timing npm:load:setTitle Completed in 0ms
21 timing config:load:flatten Completed in 2ms
22 timing npm:load:display Completed in 4ms
23 verbose logfile /home/XXX/.npm/_logs/YYY-debug-0.log
24 timing npm:load:logFile Completed in 5ms
25 timing npm:load:timers Completed in 0ms
26 timing npm:load:configScope Completed in 0ms
27 timing npm:load Completed in 25ms
28 timing command:help Completed in 17ms
29 verbose stack TypeError: Cannot read property '1' of null
29 verbose stack at /nobackup/usr/share/nodejs/npm/lib/commands/help.js:65:49
29 verbose stack at Array.sort ()
29 verbose stack at Help.exec (/nobackup/usr/share/nodejs/npm/lib/commands/help.js:63:17)
29 verbose stack at async module.exports (/nobackup/usr/share/nodejs/npm/lib/cli.js:66:5)
30 verbose cwd /home/XXX/YYY
31 verbose Linux 5.9.0-5-amd64
32 verbose argv "/nobackup/usr/bin/node" "/usr/bin/npm" "help" "config"
33 verbose node v12.22.10
34 verbose npm v8.5.5
35 error Cannot read property '1' of null
36 verbose exit 1
37 timing npm Completed in 161ms
38 verbose code 1
39 error A complete log of this run can be found in:
39 error /home/XXX/.npm/_logs/YYY-debug-0.log

Expected Behavior

I get help for the config sub-command.

Steps To Reproduce

  1. In Debian (possibly Ubuntu or others), install npm using dpkg. The important thing here is that it's installed via the system package manager, and thus using the system man directories.
  2. Install openssl. This package owns the manpage "man5/config.5ssl.gz".
  3. Run npm help config
  4. Receive error

Environment

  • npm: 8.5.5
  • Node.js: v12.22.10
  • OS Name: Debian testing
  • System Model Name: Linux 5.9.0-5-amd64 x86_64
  • npm config: (lightly scrubbed for privacy)
; "builtin" config from /nobackup/usr/share/nodejs/npm/npmrc

globalignorefile = "/etc/npmignore"
prefix = "/usr/local"

; node bin location = /nobackup/usr/bin/node
; cwd = /home/XXX/YYY
; HOME = /home/XXX
@d0sboots d0sboots added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Mar 24, 2022
d0sboots added a commit to d0sboots/cli that referenced this issue Mar 24, 2022
In certain edge cases, the glob could find files that manNumberRegex wouldn't match.

A possible solution would be to try to bring the two closer, but since globs and regexes are different syntaxes, the two will never be exactly the same.
It's always asking for bugs; better to just handle the issue directly.
d0sboots added a commit to d0sboots/cli that referenced this issue Mar 25, 2022
In certain edge cases, the glob could find files that manNumberRegex wouldn't match.

A possible solution would be to try to bring the two closer, but since globs and regexes are different syntaxes, the two will never be exactly the same.
It's always asking for bugs; better to just handle the issue directly.

In addition, when npm is installed globally in a system directory, the
glob can find other manpages with similar names.
For instance "install.1", "init.1", etc. Preferring low-numbered
sections isn't enough in these cases; it's also necessary to prefer
the pages prefixed with "npm-".
d0sboots added a commit to d0sboots/cli that referenced this issue Mar 25, 2022
In certain edge cases, the glob could find files that manNumberRegex wouldn't match.

A possible solution would be to try to bring the two closer, but since globs and regexes are different syntaxes, the two will never be exactly the same.
It's always asking for bugs; better to just handle the issue directly.

In addition, when npm is installed globally in a system directory, the
glob can find other manpages with similar names.
For instance "install.1", "init.1", etc. Preferring low-numbered
sections isn't enough in these cases; it's also necessary to prefer
the pages prefixed with "npm-".
lukekarrys pushed a commit that referenced this issue Mar 30, 2022
In certain edge cases, the glob could find files that manNumberRegex wouldn't match.

A possible solution would be to try to bring the two closer, but since globs and regexes are different syntaxes, the two will never be exactly the same.
It's always asking for bugs; better to just handle the issue directly.

In addition, when npm is installed globally in a system directory, the
glob can find other manpages with similar names.
For instance "install.1", "init.1", etc. Preferring low-numbered
sections isn't enough in these cases; it's also necessary to prefer
the pages prefixed with "npm-".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant