LoginSignup

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

Expressなどのフレームワークをインストールできなかった際に対処した記録(Node.js)

Last updated at Posted at 2023-06-21

はじめに

この記事は、node.jsで必要なフレームワークをインストールした際に、エラーが生じたため、対処した際の記事になります。そのため同じような事象が発生したとして、必ずしもこの記事と同じ対処法で、解決できる保証はありませんので、この記事は限定公開とさせていただいています。

話をまとめると

  1. node.jsでexpress、mongoose、nodemonをインストールしようとしたところ、エラーが発生した
  2. エラー内容を確認し、一度npmのキャッシュを削除(クリア)して、インストールしてみようという方針になった
  3. キャッシュを削除して、インストールし直した結果、解決することができた。

当時の流れ

1. package.jsonを作成(初期化)

npm init -y

これに関しては、通常通り処理が完了した。

2. expressとmongooseとnodemonをインストール → エラーが発生

konishishota@keesunoMacBook-Air nodejs-mongodb % npm install express mongoose nodemon
npm ERR! code Z_DATA_ERROR
npm ERR! errno -3
npm ERR! zlib: incorrect data check

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/konishishota/.npm/_logs/2023-06-21T05_02_15_606Z-debug.log

ログを確認すると、以下のようなログが記録されていた。

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/konishishota/.nvm/versions/node/v14.21.3/bin/node',
1 verbose cli   '/Users/konishishota/.nvm/versions/node/v14.21.3/bin/npm',
1 verbose cli   'install',
1 verbose cli   'express',
1 verbose cli   'mongoose',
1 verbose cli   'nodemon'
1 verbose cli ]
2 info using npm@6.14.18
3 info using node@v14.21.3
4 verbose npm-session 2085e0bc837992dc
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/nodemon 145ms (from cache)
8 http fetch GET 304 https://registry.npmjs.org/express 154ms (from cache)
9 http fetch GET 200 https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz 18ms (from cache)
10 http fetch GET 200 https://registry.npmjs.org/express/-/express-4.18.2.tgz 24ms (from cache)
11 silly pacote tag manifest for express@latest fetched in 197ms
12 silly pacote tag manifest for nodemon@latest fetched in 189ms
13 http fetch GET 200 https://registry.npmjs.org/mongoose 236ms
14 http fetch GET 200 https://registry.npmjs.org/mongoose/-/mongoose-7.3.0.tgz 95ms
15 silly pacote tag manifest for mongoose@latest fetched in 348ms
16 timing stage:loadCurrentTree Completed in 375ms
17 silly install loadIdealTree
18 silly install cloneCurrentTreeToIdealTree
19 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
20 silly install loadShrinkwrap
21 timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms
22 silly install loadAllDepsIntoIdealTree
23 silly resolveWithNewModule express@4.18.2 checking installable status
24 silly resolveWithNewModule nodemon@2.0.22 checking installable status
25 silly resolveWithNewModule mongoose@7.3.0 checking installable status
26 http fetch GET 304 https://registry.npmjs.org/content-disposition 40ms (from cache)
27 http fetch GET 304 https://registry.npmjs.org/accepts 42ms (from cache)
28 http fetch GET 304 https://registry.npmjs.org/array-flatten 43ms (from cache)
29 http fetch GET 200 https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz 5ms (from cache)
30 http fetch GET 200 https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz 7ms (from cache)
31 http fetch GET 200 https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz 7ms (from cache)
32 silly pacote range manifest for accepts@~1.3.8 fetched in 57ms
33 silly resolveWithNewModule accepts@1.3.8 checking installable status
34 silly pacote version manifest for content-disposition@0.5.4 fetched in 58ms
35 silly resolveWithNewModule content-disposition@0.5.4 checking installable status
36 silly pacote version manifest for array-flatten@1.1.1 fetched in 60ms
37 silly resolveWithNewModule array-flatten@1.1.1 checking installable status
38 http fetch GET 304 https://registry.npmjs.org/cookie-signature 74ms (from cache)
39 http fetch GET 200 https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz 4ms (from cache)
40 http fetch GET 304 https://registry.npmjs.org/content-type 87ms (from cache)
41 silly pacote version manifest for cookie-signature@1.0.6 fetched in 88ms
42 silly resolveWithNewModule cookie-signature@1.0.6 checking installable status
43 http fetch GET 304 https://registry.npmjs.org/debug 94ms (from cache)
44 http fetch GET 200 https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz 8ms (from cache)
45 http fetch GET 304 https://registry.npmjs.org/escape-html 47ms (from cache)
46 http fetch GET 304 https://registry.npmjs.org/etag 47ms (from cache)
47 http fetch GET 200 https://registry.npmjs.org/debug/-/debug-2.6.9.tgz 10ms (from cache)
48 silly pacote range manifest for content-type@~1.0.4 fetched in 111ms
49 silly resolveWithNewModule content-type@1.0.5 checking installable status
50 http fetch GET 304 https://registry.npmjs.org/encodeurl 112ms (from cache)
51 http fetch GET 304 https://registry.npmjs.org/finalhandler 55ms (from cache)
52 http fetch GET 200 https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz 9ms (from cache)
53 silly pacote version manifest for debug@2.6.9 fetched in 119ms
54 silly resolveWithNewModule debug@2.6.9 checking installable status
55 http fetch GET 200 https://registry.npmjs.org/etag/-/etag-1.8.1.tgz 11ms (from cache)
56 http fetch GET 200 https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz 10ms (from cache)
57 http fetch GET 200 https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz 8ms (from cache)
58 silly pacote range manifest for escape-html@~1.0.3 fetched in 72ms
59 silly resolveWithNewModule escape-html@1.0.3 checking installable status
60 silly pacote range manifest for etag@~1.8.1 fetched in 70ms
61 silly resolveWithNewModule etag@1.8.1 checking installable status
62 http fetch GET 304 https://registry.npmjs.org/fresh 42ms (from cache)
63 silly pacote version manifest for finalhandler@1.2.0 fetched in 73ms
64 silly resolveWithNewModule finalhandler@1.2.0 checking installable status
65 silly pacote range manifest for encodeurl@~1.0.2 fetched in 133ms
66 silly resolveWithNewModule encodeurl@1.0.2 checking installable status
67 http fetch GET 200 https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz 12ms (from cache)
68 silly pacote version manifest for fresh@0.5.2 fetched in 59ms
69 silly resolveWithNewModule fresh@0.5.2 checking installable status
70 http fetch GET 304 https://registry.npmjs.org/http-errors 39ms (from cache)
71 http fetch GET 200 https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz 2ms (from cache)
72 silly pacote version manifest for http-errors@2.0.0 fetched in 45ms
73 silly resolveWithNewModule http-errors@2.0.0 checking installable status
74 http fetch GET 304 https://registry.npmjs.org/methods 28ms (from cache)
75 http fetch GET 200 https://registry.npmjs.org/methods/-/methods-1.1.2.tgz 3ms (from cache)
76 silly pacote range manifest for methods@~1.1.2 fetched in 37ms
77 silly resolveWithNewModule methods@1.1.2 checking installable status
78 http fetch GET 304 https://registry.npmjs.org/merge-descriptors 45ms (from cache)
79 http fetch GET 200 https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz 7ms (from cache)
80 http fetch GET 304 https://registry.npmjs.org/on-finished 54ms (from cache)
81 http fetch GET 304 https://registry.npmjs.org/parseurl 50ms (from cache)
82 http fetch GET 304 https://registry.npmjs.org/path-to-regexp 49ms (from cache)
83 silly pacote version manifest for merge-descriptors@1.0.1 fetched in 70ms
84 silly resolveWithNewModule merge-descriptors@1.0.1 checking installable status
85 http fetch GET 200 https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz 12ms (from cache)
86 http fetch GET 200 https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz 19ms (from cache)
87 http fetch GET 200 https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz 14ms (from cache)
88 http fetch GET 304 https://registry.npmjs.org/proxy-addr 57ms (from cache)
89 silly pacote range manifest for parseurl@~1.3.3 fetched in 77ms
90 silly resolveWithNewModule parseurl@1.3.3 checking installable status
91 silly pacote version manifest for on-finished@2.4.1 fetched in 82ms
92 silly resolveWithNewModule on-finished@2.4.1 checking installable status
93 silly pacote version manifest for path-to-regexp@0.1.7 fetched in 77ms
94 silly resolveWithNewModule path-to-regexp@0.1.7 checking installable status
95 http fetch GET 200 https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz 11ms (from cache)
96 http fetch GET 304 https://registry.npmjs.org/qs 64ms (from cache)
97 http fetch GET 304 https://registry.npmjs.org/range-parser 60ms (from cache)
98 http fetch GET 200 https://registry.npmjs.org/qs/-/qs-6.11.0.tgz 13ms (from cache)
99 http fetch GET 200 https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz 14ms (from cache)
100 silly pacote range manifest for proxy-addr@~2.0.7 fetched in 96ms
101 silly resolveWithNewModule proxy-addr@2.0.7 checking installable status
102 silly pacote version manifest for qs@6.11.0 fetched in 96ms
103 silly resolveWithNewModule qs@6.11.0 checking installable status
104 http fetch GET 304 https://registry.npmjs.org/safe-buffer 62ms (from cache)
105 silly pacote range manifest for range-parser@~1.2.1 fetched in 91ms
106 silly resolveWithNewModule range-parser@1.2.1 checking installable status
107 http fetch GET 200 https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz 5ms (from cache)
108 http fetch GET 304 https://registry.npmjs.org/send 53ms (from cache)
109 http fetch GET 304 https://registry.npmjs.org/serve-static 52ms (from cache)
110 http fetch GET 304 https://registry.npmjs.org/setprototypeof 49ms (from cache)
111 silly pacote version manifest for safe-buffer@5.2.1 fetched in 74ms
112 silly resolveWithNewModule safe-buffer@5.2.1 checking installable status
113 http fetch GET 200 https://registry.npmjs.org/send/-/send-0.18.0.tgz 7ms (from cache)
114 http fetch GET 200 https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz 8ms (from cache)
115 http fetch GET 200 https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz 9ms (from cache)
116 silly pacote version manifest for setprototypeof@1.2.0 fetched in 71ms
117 silly resolveWithNewModule setprototypeof@1.2.0 checking installable status
118 silly pacote version manifest for serve-static@1.15.0 fetched in 74ms
119 silly resolveWithNewModule serve-static@1.15.0 checking installable status
120 silly pacote version manifest for send@0.18.0 fetched in 77ms
121 silly resolveWithNewModule send@0.18.0 checking installable status
122 http fetch GET 304 https://registry.npmjs.org/statuses 40ms (from cache)
123 http fetch GET 304 https://registry.npmjs.org/type-is 38ms (from cache)
124 http fetch GET 200 https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz 8ms (from cache)
125 http fetch GET 304 https://registry.npmjs.org/utils-merge 43ms (from cache)
126 http fetch GET 200 https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz 10ms (from cache)
127 silly pacote version manifest for statuses@2.0.1 fetched in 56ms
128 silly resolveWithNewModule statuses@2.0.1 checking installable status
129 silly pacote range manifest for type-is@~1.6.18 fetched in 51ms
130 silly resolveWithNewModule type-is@1.6.18 checking installable status
131 http fetch GET 200 https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz 3ms (from cache)
132 silly pacote version manifest for utils-merge@1.0.1 fetched in 48ms
133 silly resolveWithNewModule utils-merge@1.0.1 checking installable status
134 http fetch GET 304 https://registry.npmjs.org/vary 46ms (from cache)
135 http fetch GET 200 https://registry.npmjs.org/vary/-/vary-1.1.2.tgz 1ms (from cache)
136 silly pacote range manifest for vary@~1.1.2 fetched in 49ms
137 silly resolveWithNewModule vary@1.1.2 checking installable status
138 http fetch GET 304 https://registry.npmjs.org/depd 660ms (from cache)
139 http fetch GET 304 https://registry.npmjs.org/body-parser 663ms (from cache)
140 http fetch GET 200 https://registry.npmjs.org/depd/-/depd-2.0.0.tgz 9ms (from cache)
141 http fetch GET 200 https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz 8ms (from cache)
142 silly pacote version manifest for depd@2.0.0 fetched in 676ms
143 silly resolveWithNewModule depd@2.0.0 checking installable status
144 silly pacote version manifest for body-parser@1.20.1 fetched in 678ms
145 silly resolveWithNewModule body-parser@1.20.1 checking installable status
146 http fetch GET 304 https://registry.npmjs.org/cookie 678ms (from cache)
147 http fetch GET 200 https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz 2ms (from cache)
148 silly pacote version manifest for cookie@0.5.0 fetched in 682ms
149 silly resolveWithNewModule cookie@0.5.0 checking installable status
150 http fetch GET 304 https://registry.npmjs.org/mime-types 38ms (from cache)
151 http fetch GET 304 https://registry.npmjs.org/negotiator 42ms (from cache)
152 silly pacote range manifest for mime-types@~2.1.34 fetched in 47ms
153 silly resolveWithNewModule mime-types@2.1.35 checking installable status
154 http fetch GET 200 https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz 6ms (from cache)
155 silly pacote version manifest for negotiator@0.6.3 fetched in 52ms
156 silly resolveWithNewModule negotiator@0.6.3 checking installable status
157 http fetch GET 304 https://registry.npmjs.org/mime-db 29ms (from cache)
158 silly pacote version manifest for mime-db@1.52.0 fetched in 30ms
159 silly resolveWithNewModule mime-db@1.52.0 checking installable status
160 http fetch GET 304 https://registry.npmjs.org/bytes 49ms (from cache)
161 http fetch GET 304 https://registry.npmjs.org/unpipe 54ms (from cache)
162 http fetch GET 304 https://registry.npmjs.org/destroy 55ms (from cache)
163 http fetch GET 200 https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz 7ms (from cache)
164 http fetch GET 304 https://registry.npmjs.org/iconv-lite 60ms (from cache)
165 http fetch GET 304 https://registry.npmjs.org/raw-body 62ms (from cache)
166 http fetch GET 200 https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz 9ms (from cache)
167 http fetch GET 200 https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz 10ms (from cache)
168 silly pacote version manifest for bytes@3.1.2 fetched in 67ms
169 silly resolveWithNewModule bytes@3.1.2 checking installable status
170 http fetch GET 200 https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz 10ms (from cache)
171 http fetch GET 200 https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz 12ms (from cache)
172 silly pacote version manifest for unpipe@1.0.0 fetched in 77ms
173 silly resolveWithNewModule unpipe@1.0.0 checking installable status
174 silly pacote version manifest for destroy@1.2.0 fetched in 80ms
175 silly resolveWithNewModule destroy@1.2.0 checking installable status
176 silly pacote version manifest for iconv-lite@0.4.24 fetched in 80ms
177 silly resolveWithNewModule iconv-lite@0.4.24 checking installable status
178 silly pacote version manifest for raw-body@2.5.1 fetched in 80ms
179 silly resolveWithNewModule raw-body@2.5.1 checking installable status
180 http fetch GET 304 https://registry.npmjs.org/ms 682ms (from cache)
181 http fetch GET 200 https://registry.npmjs.org/ms/-/ms-2.0.0.tgz 4ms (from cache)
182 silly pacote version manifest for ms@2.0.0 fetched in 696ms
183 silly resolveWithNewModule ms@2.0.0 checking installable status
184 http fetch GET 304 https://registry.npmjs.org/toidentifier 43ms (from cache)
185 http fetch GET 200 https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz 3ms (from cache)
186 silly pacote version manifest for toidentifier@1.0.1 fetched in 51ms
187 silly resolveWithNewModule toidentifier@1.0.1 checking installable status
188 http fetch GET 304 https://registry.npmjs.org/inherits 698ms (from cache)
189 http fetch GET 200 https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz 4ms (from cache)
190 silly pacote version manifest for inherits@2.0.4 fetched in 708ms
191 silly resolveWithNewModule inherits@2.0.4 checking installable status
192 http fetch GET 304 https://registry.npmjs.org/safer-buffer 34ms (from cache)
193 http fetch GET 200 https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz 5ms (from cache)
194 silly pacote range manifest for safer-buffer@>= 2.1.2 < 3 fetched in 42ms
195 silly resolveWithNewModule safer-buffer@2.1.2 checking installable status
196 http fetch GET 304 https://registry.npmjs.org/ee-first 51ms (from cache)
197 http fetch GET 200 https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz 3ms (from cache)
198 silly pacote version manifest for ee-first@1.1.1 fetched in 58ms
199 silly resolveWithNewModule ee-first@1.1.1 checking installable status
200 http fetch GET 304 https://registry.npmjs.org/side-channel 31ms (from cache)
201 http fetch GET 200 https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz 3ms (from cache)
202 silly pacote range manifest for side-channel@^1.0.4 fetched in 35ms
203 silly resolveWithNewModule side-channel@1.0.4 checking installable status
204 http fetch GET 304 https://registry.npmjs.org/call-bind 30ms (from cache)
205 http fetch GET 304 https://registry.npmjs.org/object-inspect 32ms (from cache)
206 http fetch GET 200 https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz 3ms (from cache)
207 http fetch GET 200 https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz 2ms (from cache)
208 silly pacote range manifest for call-bind@^1.0.0 fetched in 38ms
209 silly resolveWithNewModule call-bind@1.0.2 checking installable status
210 silly pacote range manifest for object-inspect@^1.9.0 fetched in 38ms
211 silly resolveWithNewModule object-inspect@1.12.3 checking installable status
212 http fetch GET 304 https://registry.npmjs.org/get-intrinsic 613ms (from cache)
213 http fetch GET 200 https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz 2ms (from cache)
214 silly pacote range manifest for get-intrinsic@^1.0.2 fetched in 617ms
215 silly resolveWithNewModule get-intrinsic@1.2.1 checking installable status
216 http fetch GET 304 https://registry.npmjs.org/function-bind 36ms (from cache)
217 http fetch GET 200 https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz 2ms (from cache)
218 silly pacote range manifest for function-bind@^1.1.1 fetched in 40ms
219 silly resolveWithNewModule function-bind@1.1.1 checking installable status
220 http fetch GET 304 https://registry.npmjs.org/has-symbols 38ms (from cache)
221 http fetch GET 304 https://registry.npmjs.org/has-proto 41ms (from cache)
222 http fetch GET 200 https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz 4ms (from cache)
223 http fetch GET 200 https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz 4ms (from cache)
224 silly pacote range manifest for has-symbols@^1.0.3 fetched in 46ms
225 silly resolveWithNewModule has-symbols@1.0.3 checking installable status
226 silly pacote range manifest for has-proto@^1.0.1 fetched in 47ms
227 silly resolveWithNewModule has-proto@1.0.1 checking installable status
228 http fetch GET 304 https://registry.npmjs.org/has 608ms (from cache)
229 http fetch GET 200 https://registry.npmjs.org/has/-/has-1.0.3.tgz 4ms (from cache)
230 silly pacote range manifest for has@^1.0.3 fetched in 617ms
231 silly resolveWithNewModule has@1.0.3 checking installable status
232 http fetch GET 304 https://registry.npmjs.org/media-typer 31ms (from cache)
233 http fetch GET 200 https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz 3ms (from cache)
234 silly pacote version manifest for media-typer@0.3.0 fetched in 38ms
235 silly resolveWithNewModule media-typer@0.3.0 checking installable status
236 http fetch GET 304 https://registry.npmjs.org/forwarded 31ms (from cache)
237 http fetch GET 200 https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz 3ms (from cache)
238 http fetch GET 304 https://registry.npmjs.org/ipaddr.js 36ms (from cache)
239 silly pacote version manifest for forwarded@0.2.0 fetched in 39ms
240 silly resolveWithNewModule forwarded@0.2.0 checking installable status
241 http fetch GET 200 https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz 3ms (from cache)
242 silly pacote version manifest for ipaddr.js@1.9.1 fetched in 42ms
243 silly resolveWithNewModule ipaddr.js@1.9.1 checking installable status
244 http fetch GET 200 https://registry.npmjs.org/ms/-/ms-2.1.3.tgz 4ms (from cache)
245 silly pacote version manifest for ms@2.1.3 fetched in 6ms
246 silly resolveWithNewModule ms@2.1.3 checking installable status
247 http fetch GET 304 https://registry.npmjs.org/mime 46ms (from cache)
248 http fetch GET 200 https://registry.npmjs.org/mime/-/mime-1.6.0.tgz 3ms (from cache)
249 silly pacote version manifest for mime@1.6.0 fetched in 52ms
250 silly resolveWithNewModule mime@1.6.0 checking installable status
251 silly pacote version manifest for ms@2.1.3 fetched in 3ms
252 silly resolveWithNewModule ms@2.1.3 checking installable status
253 http fetch GET 200 https://registry.npmjs.org/kareem 34ms
254 http fetch GET 200 https://registry.npmjs.org/mquery 47ms
255 http fetch GET 200 https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz 33ms
256 silly pacote version manifest for kareem@2.5.1 fetched in 70ms
257 silly resolveWithNewModule kareem@2.5.1 checking installable status
258 http fetch GET 200 https://registry.npmjs.org/bson 79ms
259 http fetch GET 200 https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz 37ms
260 silly pacote version manifest for mquery@5.0.0 fetched in 87ms
261 silly resolveWithNewModule mquery@5.0.0 checking installable status
262 http fetch GET 200 https://registry.npmjs.org/mongodb 93ms
263 silly fetchPackageMetaData error for bson@^5.3.0 zlib: incorrect data check
264 http fetch GET 200 https://registry.npmjs.org/mongodb/-/mongodb-5.6.0.tgz 98ms
265 silly pacote version manifest for mongodb@5.6.0 fetched in 200ms
266 silly resolveWithNewModule mongodb@5.6.0 checking installable status
267 http fetch GET 200 https://registry.npmjs.org/mpath 679ms
268 http fetch GET 200 https://registry.npmjs.org/sift 698ms
269 http fetch GET 200 https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz 47ms
270 silly pacote version manifest for mpath@0.9.0 fetched in 746ms
271 silly resolveWithNewModule mpath@0.9.0 checking installable status
272 http fetch GET 200 https://registry.npmjs.org/sift/-/sift-16.0.1.tgz 46ms
273 silly pacote version manifest for sift@16.0.1 fetched in 751ms
274 silly resolveWithNewModule sift@16.0.1 checking installable status
275 timing stage:rollbackFailedOptional Completed in 0ms
276 timing stage:runTopLevelLifecycles Completed in 5004ms
277 silly saveTree nodejs-mongodb@1.0.0
277 silly saveTree ├─┬ express@4.18.2
277 silly saveTree │ ├─┬ accepts@1.3.8
277 silly saveTree │ │ ├─┬ mime-types@2.1.35
277 silly saveTree │ │ │ └── mime-db@1.52.0
277 silly saveTree │ │ └── negotiator@0.6.3
277 silly saveTree │ ├── array-flatten@1.1.1
277 silly saveTree │ ├─┬ body-parser@1.20.1
277 silly saveTree │ │ ├── bytes@3.1.2
277 silly saveTree │ │ ├── content-type@1.0.5
277 silly saveTree │ │ ├─┬ debug@2.6.9
277 silly saveTree │ │ │ └── ms@2.0.0
277 silly saveTree │ │ ├── depd@2.0.0
277 silly saveTree │ │ ├── destroy@1.2.0
277 silly saveTree │ │ ├─┬ http-errors@2.0.0
277 silly saveTree │ │ │ ├── inherits@2.0.4
277 silly saveTree │ │ │ ├── setprototypeof@1.2.0
277 silly saveTree │ │ │ ├── statuses@2.0.1
277 silly saveTree │ │ │ └── toidentifier@1.0.1
277 silly saveTree │ │ ├─┬ iconv-lite@0.4.24
277 silly saveTree │ │ │ └── safer-buffer@2.1.2
277 silly saveTree │ │ ├─┬ on-finished@2.4.1
277 silly saveTree │ │ │ └── ee-first@1.1.1
277 silly saveTree │ │ ├─┬ qs@6.11.0
277 silly saveTree │ │ │ └─┬ side-channel@1.0.4
277 silly saveTree │ │ │   ├─┬ call-bind@1.0.2
277 silly saveTree │ │ │   │ ├── function-bind@1.1.1
277 silly saveTree │ │ │   │ └─┬ get-intrinsic@1.2.1
277 silly saveTree │ │ │   │   ├── has-proto@1.0.1
277 silly saveTree │ │ │   │   ├── has-symbols@1.0.3
277 silly saveTree │ │ │   │   └── has@1.0.3
277 silly saveTree │ │ │   ├── get-intrinsic@1.2.1
277 silly saveTree │ │ │   └── object-inspect@1.12.3
277 silly saveTree │ │ ├─┬ raw-body@2.5.1
277 silly saveTree │ │ │ └── unpipe@1.0.0
277 silly saveTree │ │ ├─┬ type-is@1.6.18
277 silly saveTree │ │ │ └── media-typer@0.3.0
277 silly saveTree │ │ └── unpipe@1.0.0
277 silly saveTree │ ├─┬ content-disposition@0.5.4
277 silly saveTree │ │ └── safe-buffer@5.2.1
277 silly saveTree │ ├── content-type@1.0.5
277 silly saveTree │ ├── cookie-signature@1.0.6
277 silly saveTree │ ├── cookie@0.5.0
277 silly saveTree │ ├── debug@2.6.9
277 silly saveTree │ ├── depd@2.0.0
277 silly saveTree │ ├── encodeurl@1.0.2
277 silly saveTree │ ├── escape-html@1.0.3
277 silly saveTree │ ├── etag@1.8.1
277 silly saveTree │ ├─┬ finalhandler@1.2.0
277 silly saveTree │ │ └── parseurl@1.3.3
277 silly saveTree │ ├── fresh@0.5.2
277 silly saveTree │ ├── http-errors@2.0.0
277 silly saveTree │ ├── merge-descriptors@1.0.1
277 silly saveTree │ ├── methods@1.1.2
277 silly saveTree │ ├── on-finished@2.4.1
277 silly saveTree │ ├── parseurl@1.3.3
277 silly saveTree │ ├── path-to-regexp@0.1.7
277 silly saveTree │ ├─┬ proxy-addr@2.0.7
277 silly saveTree │ │ ├── forwarded@0.2.0
277 silly saveTree │ │ └── ipaddr.js@1.9.1
277 silly saveTree │ ├── qs@6.11.0
277 silly saveTree │ ├── range-parser@1.2.1
277 silly saveTree │ ├── safe-buffer@5.2.1
277 silly saveTree │ ├─┬ send@0.18.0
277 silly saveTree │ │ ├── mime@1.6.0
277 silly saveTree │ │ └── ms@2.1.3
277 silly saveTree │ ├── serve-static@1.15.0
277 silly saveTree │ ├── setprototypeof@1.2.0
277 silly saveTree │ ├── statuses@2.0.1
277 silly saveTree │ ├── type-is@1.6.18
277 silly saveTree │ ├── utils-merge@1.0.1
277 silly saveTree │ └── vary@1.1.2
277 silly saveTree ├─┬ mongoose@7.3.0
277 silly saveTree │ ├── kareem@2.5.1
277 silly saveTree │ ├── mongodb@5.6.0
277 silly saveTree │ ├── mpath@0.9.0
277 silly saveTree │ ├── mquery@5.0.0
277 silly saveTree │ ├── ms@2.1.3
277 silly saveTree │ └── sift@16.0.1
277 silly saveTree └── nodemon@2.0.22
278 verbose stack ZlibError: zlib: incorrect data check
278 verbose stack     at Unzip.write (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/node_modules/minizlib/index.js:147:22)
278 verbose stack     at Object.write (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/node_modules/tar/lib/parse.js:313:19)
278 verbose stack     at PassThrough.ondata (internal/streams/readable.js:731:22)
278 verbose stack     at PassThrough.emit (events.js:400:28)
278 verbose stack     at addChunk (internal/streams/readable.js:293:12)
278 verbose stack     at readableAddChunk (internal/streams/readable.js:267:9)
278 verbose stack     at PassThrough.Readable.push (internal/streams/readable.js:206:10)
278 verbose stack     at PassThrough.Transform.push (internal/streams/transform.js:166:32)
278 verbose stack     at PassThrough.afterTransform (internal/streams/transform.js:101:10)
278 verbose stack     at PassThrough._transform (internal/streams/passthrough.js:46:3)
278 verbose stack     at PassThrough.Transform._read (internal/streams/transform.js:205:10)
278 verbose stack     at PassThrough.Transform._write (internal/streams/transform.js:193:12)
278 verbose stack     at writeOrBuffer (internal/streams/writable.js:358:12)
278 verbose stack     at PassThrough.Writable.write (internal/streams/writable.js:303:10)
278 verbose stack     at DestroyableTransform.ondata (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:619:20)
278 verbose stack     at DestroyableTransform.emit (events.js:400:28)
279 verbose cwd /Users/konishishota/projects/nodejs-mongodb
280 verbose Darwin 22.5.0
281 verbose argv "/Users/konishishota/.nvm/versions/node/v14.21.3/bin/node" "/Users/konishishota/.nvm/versions/node/v14.21.3/bin/npm" "install" "express" "mongoose" "nodemon"
282 verbose node v14.21.3
283 verbose npm  v6.14.18
284 error code Z_DATA_ERROR
285 error errno -3
286 error zlib: incorrect data check
287 verbose exit [ -3, true ]

nodemonとexpressのパッケージがキャッシュから取得され、mongooseのパッケージはネットワークからダウンロードされているようだった。

3.npmのキャッシュをクリアする方針へ

npm cache clean

エラーが発生

konishishota@keesunoMacBook-Air nodejs-mongodb % npm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
npm ERR! 
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/konishishota/.npm/_logs/2023-06-21T05_11_37_349Z-debug.log

ログを確認

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/konishishota/.nvm/versions/node/v14.21.3/bin/node',
1 verbose cli   '/Users/konishishota/.nvm/versions/node/v14.21.3/bin/npm',
1 verbose cli   'cache',
1 verbose cli   'clean'
1 verbose cli ]
2 info using npm@6.14.18
3 info using node@v14.21.3
4 verbose npm-session 52f76f1b67d50339
5 verbose stack Error: As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
5 verbose stack
5 verbose stack If you're sure you want to delete the entire cache, rerun this command with --force.
5 verbose stack     at clean (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/lib/cache.js:72:22)
5 verbose stack     at EventEmitter.cache (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/lib/cache.js:47:16)
5 verbose stack     at Object.commandCache.<computed> (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/lib/npm.js:156:13)
5 verbose stack     at EventEmitter.<anonymous> (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/bin/npm-cli.js:133:30)
5 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:77:11)
6 verbose cwd /Users/konishishota/projects/nodejs-mongodb
7 verbose Darwin 22.5.0
8 verbose argv "/Users/konishishota/.nvm/versions/node/v14.21.3/bin/node" "/Users/konishishota/.nvm/versions/node/v14.21.3/bin/npm" "cache" "clean"
9 verbose node v14.21.3
10 verbose npm  v6.14.18
11 error As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
11 error
11 error If you're sure you want to delete the entire cache, rerun this command with --force.
12 verbose exit [ 1, true ]

npmのキャッシュの整合性を検証し、修復してみた。

konishishota@keesunoMacBook-Air nodejs-mongodb % npm cache verify
Cache verified and compressed (~/.npm/_cacache):
Content verified: 4207 (239465671 bytes)
Content garbage-collected: 162 (79496635 bytes)
Index entries: 4436
Finished in 3.535s

しかし、整合性が確保されている模様で、修復は行われなかったようだった。

4. もう一度、キャッシュをクリア

npm cache clean 

同様のエラーログが表示されてしまった。

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/konishishota/.nvm/versions/node/v14.21.3/bin/node',
1 verbose cli   '/Users/konishishota/.nvm/versions/node/v14.21.3/bin/npm',
1 verbose cli   'cache',
1 verbose cli   'clean'
1 verbose cli ]
2 info using npm@6.14.18
3 info using node@v14.21.3
4 verbose npm-session 23ea5b3878503738
5 verbose stack Error: As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
5 verbose stack
5 verbose stack If you're sure you want to delete the entire cache, rerun this command with --force.
5 verbose stack     at clean (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/lib/cache.js:72:22)
5 verbose stack     at EventEmitter.cache (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/lib/cache.js:47:16)
5 verbose stack     at Object.commandCache.<computed> (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/lib/npm.js:156:13)
5 verbose stack     at EventEmitter.<anonymous> (/Users/konishishota/.nvm/versions/node/v14.21.3/lib/node_modules/npm/bin/npm-cli.js:133:30)
5 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:77:11)
6 verbose cwd /Users/konishishota/projects/nodejs-mongodb
7 verbose Darwin 22.5.0
8 verbose argv "/Users/konishishota/.nvm/versions/node/v14.21.3/bin/node" "/Users/konishishota/.nvm/versions/node/v14.21.3/bin/npm" "cache" "clean"
9 verbose node v14.21.3
10 verbose npm  v6.14.18
11 error As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
11 error
11 error If you're sure you want to delete the entire cache, rerun this command with --force.
12 verbose exit [ 1, true ]

5. キャッシュを完全に削除するコマンドを実行することにした

他に対処する方法が分からなかったため、強制的にキャッシュを削除するコマンドを実行した。※これは最終手段です。

npm cache clean --force

実行は無事に終わった。

konishishota@keesunoMacBook-Air nodejs-mongodb % npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.

6. 再び、expressとmongooseとnodemonをインストール

npm install express mongoose nodemon

成功した模様。

konishishota@keesunoMacBook-Air nodejs-mongodb % npm install express mongoose nodemon
npm WARN tar zlib: incorrect data check
npm WARN tarball cached data for bson@^5.3.0 (sha512-ukmCZMneMlaC5ebPHXIkP8YJzNl5DC41N5MAIvKDqLggdao342t4McltoJBQfQya/nHBWAcSsYRqlXPoQkTJag==) seems to be corrupted. Refreshing cache.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN nodejs-mongodb@1.0.0 No description
npm WARN nodejs-mongodb@1.0.0 No repository field.

+ express@4.18.2
+ mongoose@7.3.0
+ nodemon@2.0.22
added 115 packages from 129 contributors and audited 115 packages in 16.396s

12 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

package.jsonの中身を確認しても、インストールしたフレームワークが揃っています。
スクリーンショット 2023-06-21 14.23.42.png

0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up