npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.49k stars 3.17k forks source link

[BUG] npm install causes TypeError #7012

Closed Yoshiboi18303 closed 12 months ago

Yoshiboi18303 commented 12 months ago

Is there an existing issue for this?

This issue exists in the latest npm version

Current Behavior

I was gonna install the package winston, but then the package @npmcli/arborist threw a TypeError.

Here's the log, if that helps:

0 verbose cli C:\Program Files\nodejs\node.exe C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
1 info using npm@10.2.4
2 info using node@v18.18.2
3 timing npm:load:whichnode Completed in 2ms
4 timing config:load:defaults Completed in 4ms
5 timing config:load:file:C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 11ms
6 timing config:load:builtin Completed in 12ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\Users\yoshi\OneDrive\Desktop\Bots\oceanic-bot\.npmrc Completed in 0ms
10 timing config:load:project Completed in 3ms
11 timing config:load:file:C:\Users\yoshi\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\yoshi\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 1ms
16 timing config:load Completed in 24ms
17 timing npm:load:configload Completed in 24ms
18 timing config:load:flatten Completed in 7ms
19 timing npm:load:mkdirpcache Completed in 1ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm install
22 verbose argv "install"
23 timing npm:load:setTitle Completed in 1ms
24 timing npm:load:display Completed in 1ms
25 verbose logfile logs-max:10 dir:C:\Users\yoshi\AppData\Local\npm-cache\_logs\2023-11-21T17_48_03_195Z-
26 verbose logfile C:\Users\yoshi\AppData\Local\npm-cache\_logs\2023-11-21T17_48_03_195Z-debug-0.log
27 timing npm:load:logFile Completed in 15ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 93ms
31 timing arborist:ctor Completed in 0ms
32 silly logfile start cleaning logs, removing 2 files
33 timing arborist:ctor Completed in 0ms
34 silly logfile done cleaning log files
35 timing idealTree:init Completed in 1220ms
36 timing idealTree:userRequests Completed in 1ms
37 silly idealTree buildDeps
38 silly fetch manifest winston@3.11.0
39 http fetch GET 200 https://registry.npmjs.org/winston 182ms (cache hit)
40 silly placeDep ROOT winston@3.11.0 OK for: oceanic-bot@1.0.0 want: 3.11.0
41 silly fetch manifest @dabh/diagnostics@^2.0.2
42 silly fetch manifest @colors/colors@^1.6.0
43 silly fetch manifest async@^3.2.3
44 silly fetch manifest is-stream@^2.0.0
45 silly fetch manifest logform@^2.4.0
46 silly fetch manifest one-time@^1.0.0
47 silly fetch manifest readable-stream@^3.4.0
48 silly fetch manifest safe-stable-stringify@^2.3.1
49 silly fetch manifest stack-trace@0.0.x
50 silly fetch manifest triple-beam@^1.3.0
51 silly fetch manifest winston-transport@^4.5.0
52 http fetch GET 200 https://registry.npmjs.org/@dabh%2fdiagnostics 104ms (cache hit)
53 http fetch GET 200 https://registry.npmjs.org/is-stream 103ms (cache hit)
54 http fetch GET 200 https://registry.npmjs.org/async 107ms (cache hit)
55 http fetch GET 200 https://registry.npmjs.org/one-time 113ms (cache hit)
56 http fetch GET 200 https://registry.npmjs.org/logform 116ms (cache hit)
57 http fetch GET 200 https://registry.npmjs.org/safe-stable-stringify 115ms (cache hit)
58 http fetch GET 200 https://registry.npmjs.org/stack-trace 116ms (cache hit)
59 http fetch GET 200 https://registry.npmjs.org/triple-beam 117ms (cache hit)
60 http fetch GET 200 https://registry.npmjs.org/readable-stream 121ms (cache hit)
61 http fetch GET 200 https://registry.npmjs.org/winston-transport 124ms (cache hit)
62 http fetch GET 200 https://registry.npmjs.org/@colors%2fcolors 132ms (cache hit)
63 timing idealTree:#root Completed in 352ms
64 silly placeDep ROOT @colors/colors@1.6.0 OK for: winston@3.11.0 want: ^1.6.0
65 silly placeDep ROOT @dabh/diagnostics@2.0.3 OK for: winston@3.11.0 want: ^2.0.2
66 silly fetch manifest colorspace@1.1.x
67 silly fetch manifest enabled@2.0.x
68 silly fetch manifest kuler@^2.0.0
69 silly placeDep ROOT async@3.2.5 OK for: winston@3.11.0 want: ^3.2.3
70 silly placeDep ROOT is-stream@2.0.1 OK for: winston@3.11.0 want: ^2.0.0
71 silly placeDep ROOT logform@2.6.0 OK for: winston@3.11.0 want: ^2.4.0
72 silly fetch manifest @types/triple-beam@^1.3.2
73 silly fetch manifest fecha@^4.2.0
74 silly fetch manifest ms@^2.1.1
75 silly placeDep ROOT one-time@1.0.0 OK for: winston@3.11.0 want: ^1.0.0
76 silly fetch manifest fn.name@1.x.x
77 silly placeDep ROOT readable-stream@3.6.2 OK for: winston@3.11.0 want: ^3.4.0
78 silly fetch manifest inherits@^2.0.3
79 silly fetch manifest string_decoder@^1.1.1
80 silly fetch manifest util-deprecate@^1.0.1
81 silly placeDep ROOT safe-stable-stringify@2.4.3 OK for: winston@3.11.0 want: ^2.3.1
82 silly placeDep ROOT stack-trace@0.0.10 OK for: winston@3.11.0 want: 0.0.x
83 silly placeDep ROOT triple-beam@1.4.1 OK for: winston@3.11.0 want: ^1.3.0
84 silly placeDep ROOT winston-transport@4.6.0 OK for: winston@3.11.0 want: ^4.5.0
85 http fetch GET 200 https://registry.npmjs.org/enabled 77ms (cache hit)
86 http fetch GET 200 https://registry.npmjs.org/colorspace 77ms (cache hit)
87 http fetch GET 200 https://registry.npmjs.org/kuler 76ms (cache hit)
88 http fetch GET 200 https://registry.npmjs.org/ms 61ms (cache hit)
89 http fetch GET 200 https://registry.npmjs.org/fecha 62ms (cache hit)
90 http fetch GET 200 https://registry.npmjs.org/@types%2ftriple-beam 64ms (cache hit)
91 http fetch GET 200 https://registry.npmjs.org/fn.name 60ms (cache hit)
92 http fetch GET 200 https://registry.npmjs.org/util-deprecate 55ms (cache hit)
93 http fetch GET 200 https://registry.npmjs.org/string_decoder 57ms (cache hit)
94 http fetch GET 200 https://registry.npmjs.org/inherits 58ms (cache hit)
95 timing idealTree:node_modules/winston Completed in 108ms
96 timing idealTree:node_modules/@colors/colors Completed in 0ms
97 silly placeDep ROOT colorspace@1.1.4 OK for: @dabh/diagnostics@2.0.3 want: 1.1.x
98 silly fetch manifest color@^3.1.3
99 silly fetch manifest text-hex@1.0.x
100 silly placeDep ROOT enabled@2.0.0 OK for: @dabh/diagnostics@2.0.3 want: 2.0.x
101 silly placeDep ROOT kuler@2.0.0 OK for: @dabh/diagnostics@2.0.3 want: ^2.0.0
102 http fetch GET 200 https://registry.npmjs.org/text-hex 17ms (cache hit)
103 http fetch GET 200 https://registry.npmjs.org/color 19ms (cache hit)
104 timing idealTree:node_modules/@dabh/diagnostics Completed in 31ms
105 timing idealTree:node_modules/async Completed in 0ms
106 silly placeDep ROOT color@3.2.1 OK for: colorspace@1.1.4 want: ^3.1.3
107 silly fetch manifest color-convert@^1.9.3
108 silly fetch manifest color-string@^1.6.0
109 silly placeDep ROOT text-hex@1.0.0 OK for: colorspace@1.1.4 want: 1.0.x
110 http fetch GET 200 https://registry.npmjs.org/color-string 12ms (cache hit)
111 http fetch GET 200 https://registry.npmjs.org/color-convert 17ms (cache hit)
112 timing idealTree:node_modules/colorspace Completed in 26ms
113 silly placeDep ROOT color-convert@1.9.3 OK for: color@3.2.1 want: ^1.9.3
114 silly fetch manifest color-name@1.1.3
115 silly placeDep ROOT color-string@1.9.1 OK for: color@3.2.1 want: ^1.6.0
116 silly fetch manifest color-name@^1.0.0
117 silly fetch manifest simple-swizzle@^0.2.2
118 http fetch GET 200 https://registry.npmjs.org/color-name 23ms (cache hit)
119 http fetch GET 200 https://registry.npmjs.org/color-name 30ms (cache hit)
120 http fetch GET 200 https://registry.npmjs.org/simple-swizzle 24ms (cache hit)
121 timing idealTree:node_modules/color Completed in 42ms
122 silly placeDep ROOT color-name@1.1.3 OK for: color-convert@1.9.3 want: 1.1.3
123 timing idealTree:node_modules/color-convert Completed in 4ms
124 timing idealTree:node_modules/color-name Completed in 0ms
125 silly placeDep ROOT simple-swizzle@0.2.2 OK for: color-string@1.9.1 want: ^0.2.2
126 silly fetch manifest is-arrayish@^0.3.1
127 http fetch GET 200 https://registry.npmjs.org/is-arrayish 9ms (cache hit)
128 timing idealTree:node_modules/color-string Completed in 13ms
129 timing idealTree:node_modules/enabled Completed in 0ms
130 timing idealTree:node_modules/is-stream Completed in 0ms
131 timing idealTree:node_modules/kuler Completed in 0ms
132 silly placeDep ROOT @types/triple-beam@1.3.5 OK for: logform@2.6.0 want: ^1.3.2
133 silly placeDep ROOT fecha@4.2.3 OK for: logform@2.6.0 want: ^4.2.0
134 silly placeDep ROOT ms@2.1.3 OK for: logform@2.6.0 want: ^2.1.1
135 timing idealTree:node_modules/logform Completed in 9ms
136 timing idealTree:node_modules/@types/triple-beam Completed in 0ms
137 timing idealTree:node_modules/fecha Completed in 0ms
138 timing idealTree:node_modules/ms Completed in 0ms
139 silly placeDep ROOT fn.name@1.1.0 OK for: one-time@1.0.0 want: 1.x.x
140 timing idealTree:node_modules/one-time Completed in 2ms
141 timing idealTree:node_modules/fn.name Completed in 0ms
142 silly placeDep ROOT inherits@2.0.4 OK for: readable-stream@3.6.2 want: ^2.0.3
143 silly placeDep ROOT string_decoder@1.3.0 OK for: readable-stream@3.6.2 want: ^1.1.1
144 silly fetch manifest safe-buffer@~5.2.0
145 silly placeDep ROOT util-deprecate@1.0.2 OK for: readable-stream@3.6.2 want: ^1.0.1
146 http fetch GET 200 https://registry.npmjs.org/safe-buffer 25ms (cache hit)
147 timing idealTree:node_modules/readable-stream Completed in 32ms
148 timing idealTree:node_modules/inherits Completed in 0ms
149 timing idealTree:node_modules/safe-stable-stringify Completed in 0ms
150 silly placeDep ROOT is-arrayish@0.3.2 OK for: simple-swizzle@0.2.2 want: ^0.3.1
151 timing idealTree:node_modules/simple-swizzle Completed in 2ms
152 timing idealTree:node_modules/is-arrayish Completed in 0ms
153 timing idealTree:node_modules/stack-trace Completed in 0ms
154 silly placeDep ROOT safe-buffer@5.2.1 OK for: string_decoder@1.3.0 want: ~5.2.0
155 timing idealTree:node_modules/string_decoder Completed in 2ms
156 timing idealTree:node_modules/safe-buffer Completed in 0ms
157 timing idealTree:node_modules/text-hex Completed in 0ms
158 timing idealTree:node_modules/triple-beam Completed in 0ms
159 timing idealTree:node_modules/util-deprecate Completed in 0ms
160 timing idealTree:node_modules/winston-transport Completed in 0ms
161 silly fetch manifest @definitelytyped/dtslint@^0.0.133
162 http fetch GET 200 https://registry.npmjs.org/@definitelytyped%2fdtslint 19ms (cache hit)
163 silly fetch manifest typescript@^4.8.4
164 http fetch GET 200 https://registry.npmjs.org/typescript 54ms (cache hit)
165 silly fetch manifest @types/node@^18.11.3
166 http fetch GET 200 https://registry.npmjs.org/@types%2fnode 72ms (cache hit)
167 silly fetch manifest decache@^4.6.1
168 http fetch GET 200 https://registry.npmjs.org/decache 13ms (cache hit)
169 silly fetch manifest sinon@^14.0.1
170 http fetch GET 200 https://registry.npmjs.org/sinon 7ms (cache hit)
171 silly fetch manifest standard@^17.0.0
172 http fetch GET 200 https://registry.npmjs.org/standard 6ms (cache hit)
173 silly fetch manifest standard-markdown@^7.1.0
174 http fetch GET 200 https://registry.npmjs.org/standard-markdown 12ms (cache hit)
175 silly fetch manifest standard-version@^9.5.0
176 http fetch GET 200 https://registry.npmjs.org/standard-version 11ms (cache hit)
177 silly fetch manifest tap@^16.3.0
178 http fetch GET 200 https://registry.npmjs.org/tap 16ms (cache hit)
179 silly fetch manifest coveralls@^3.1.1
180 http fetch GET 200 https://registry.npmjs.org/coveralls 13ms (cache hit)
181 silly fetch manifest flow-remove-types@>=2.112.0
182 http fetch GET 200 https://registry.npmjs.org/flow-remove-types 7ms (cache hit)
183 silly fetch manifest ts-node@>=8.5.2
184 http fetch GET 200 https://registry.npmjs.org/ts-node 6ms (cache hit)
185 silly fetch manifest @swc/core@>=1.2.50
186 http fetch GET 200 https://registry.npmjs.org/@swc%2fcore 15ms (cache hit)
187 silly fetch manifest @swc/helpers@^0.5.0
188 http fetch GET 200 https://registry.npmjs.org/@swc%2fhelpers 16ms (cache hit)
189 silly fetch manifest @swc/wasm@>=1.2.50
190 http fetch GET 200 https://registry.npmjs.org/@swc%2fwasm 22ms (cache hit)
191 silly fetch manifest tar@^6.1.11
192 http fetch GET 200 https://registry.npmjs.org/tar 6ms (cache hit)
193 silly placeDep ROOT @definitelytyped/dtslint@0.0.133 OK for: dotenv@16.3.1 want: ^0.0.133
194 silly placeDep ROOT typescript@4.9.5 OK for: @definitelytyped/dtslint@0.0.133 want: >= 3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.7.0-dev || >= 3.8.0-dev || >= 3.9.0-dev || >= 4.0.0-dev
195 timing idealTree Completed in 2458ms
196 timing command:install Completed in 2477ms
197 verbose stack TypeError: Cannot read properties of null (reading 'matches')
197 verbose stack     at Link.matches (C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\node.js:1115:41)
197 verbose stack     at Link.canDedupe (C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\node.js:1069:15)
197 verbose stack     at PlaceDep.pruneDedupable (C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:426:14)
197 verbose stack     at new PlaceDep (C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:278:14)
197 verbose stack     at new PlaceDep (C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:314:26)
197 verbose stack     at #buildDepStep (C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:933:18)
197 verbose stack     at async Arborist.buildIdealTree (C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:196:7)
197 verbose stack     at async Promise.all (index 1)
197 verbose stack     at async Arborist.reify (C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:159:5)
197 verbose stack     at async Install.exec (C:\Users\yoshi\AppData\Roaming\npm\node_modules\npm\lib\commands\install.js:152:5)
198 verbose cwd C:\Users\yoshi\OneDrive\Desktop\Bots\oceanic-bot
199 verbose Windows_NT 10.0.22631
200 verbose node v18.18.2
201 verbose npm  v10.2.4
202 error Cannot read properties of null (reading 'matches')
203 verbose exit 1
204 timing npm Completed in 3308ms
205 verbose unfinished npm timer reify 1700588884025
206 verbose unfinished npm timer reify:loadTrees 1700588884037
207 verbose unfinished npm timer idealTree:buildDeps 1700588885260
208 verbose unfinished npm timer idealTree:node_modules/.pnpm/dotenv@16.3.1/node_modules/dotenv 1700588885892
209 verbose code 1
210 error A complete log of this run can be found in: C:\Users\yoshi\AppData\Local\npm-cache\_logs\2023-11-21T17_48_03_195Z-debug-0.log

Expected Behavior

I expected no errors from the CLI itself.

Steps To Reproduce

  1. In any environment with the latest version of npm
  2. With any config (I'm using the default)
  3. Run 'npm install {any package}' where {any package} is replaced with the package name.
  4. A TypeError should be thrown from the package specified (@npmcli/arborist).

Environment

prefix = "C:\Users\yoshi\AppData\Roaming\npm"

; node bin location = C:\Program Files\nodejs\node.exe ; node version = v18.18.2 ; npm local prefix = C:\Users\yoshi\OneDrive\Desktop\Bots\oceanic-bot ; npm version = 10.2.4 ; cwd = C:\Users\yoshi\OneDrive\Desktop\Bots\oceanic-bot ; HOME = C:\Users\yoshi ; Run npm config ls -l to show all defaults.

Yoshiboi18303 commented 12 months ago

Forgot I was using pnpm, sorry for wasting your time there.