npm / npm

This repository is moving to: https://github.com/npm/cli
http://npm.community
17.53k stars 3.02k forks source link

Cannot read property 'latest' of undefined - On Windows 8 using NPM 2.15.9 and Node JS 4.6.1 #14326

Open dynamite-ready opened 8 years ago

dynamite-ready commented 8 years ago

I'm running into the somewhat common - Cannot read property 'latest' of undefined - error using NPM 2.15.9 and Node JS 4.6.1 on Windows 8. Any NPM package I try to install draws the error.

It's certainly not a code issue, because I can install the exact same projects and NPM packages on my OSX machine. What's more, I've not made any recent changes to my Windows 8 box on which the code worked just a week ago. What might cause this issue?

An example debug log reads as follows:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install' ]
2 info using npm@2.15.9
3 info using node@v4.6.1
4 verbose readDependencies loading dependencies from C:\Users\----\Desktop\----\package.json
5 warn package.json svg-to-png-test@0.1.0 No repository field.
6 verbose install where, deps [ 'C:\\Users\\----\\Desktop\\----',
6 verbose install   [ 'sharp', 'cheerio', 'request', 'ws', 'mocha', 'docco' ] ]
7 verbose install where, peers [ 'C:\\Users\\----\\Desktop\\----', [] ]
8 verbose installManyTop reading for lifecycle C:\Users\----\Desktop\----\package.json
9 info preinstall svg-to-png-test@0.1.0
10 verbose readDependencies loading dependencies from C:\Users\----\Desktop\----\package.json
11 silly cache add args [ 'cheerio@*', null ]
12 verbose cache add spec cheerio@*
13 silly cache add parsed spec Result {
13 silly cache add   raw: 'cheerio@*',
13 silly cache add   scope: null,
13 silly cache add   name: 'cheerio',
13 silly cache add   rawSpec: '*',
13 silly cache add   spec: '*',
13 silly cache add   type: 'range' }
14 silly addNamed cheerio@*
15 verbose addNamed "*" is a valid semver range for cheerio
16 silly addNameRange { name: 'cheerio', range: '*', hasData: false }
17 silly mapToRegistry name cheerio
18 silly mapToRegistry using default registry
19 silly mapToRegistry registry http://skimdb.npmjs.com/registry
20 silly mapToRegistry data Result {
20 silly mapToRegistry   raw: 'cheerio',
20 silly mapToRegistry   scope: null,
20 silly mapToRegistry   name: 'cheerio',
20 silly mapToRegistry   rawSpec: '',
20 silly mapToRegistry   spec: 'latest',
20 silly mapToRegistry   type: 'tag' }
21 silly mapToRegistry uri http://skimdb.npmjs.com/registry/cheerio
22 verbose addNameRange registry:http://skimdb.npmjs.com/registry/cheerio not in flight; fetching
23 silly cache add args [ 'request@*', null ]
24 verbose cache add spec request@*
25 silly cache add parsed spec Result {
25 silly cache add   raw: 'request@*',
25 silly cache add   scope: null,
25 silly cache add   name: 'request',
25 silly cache add   rawSpec: '*',
25 silly cache add   spec: '*',
25 silly cache add   type: 'range' }
26 silly addNamed request@*
27 verbose addNamed "*" is a valid semver range for request
28 silly addNameRange { name: 'request', range: '*', hasData: false }
29 silly mapToRegistry name request
30 silly mapToRegistry using default registry
31 silly mapToRegistry registry http://skimdb.npmjs.com/registry
32 silly mapToRegistry data Result {
32 silly mapToRegistry   raw: 'request',
32 silly mapToRegistry   scope: null,
32 silly mapToRegistry   name: 'request',
32 silly mapToRegistry   rawSpec: '',
32 silly mapToRegistry   spec: 'latest',
32 silly mapToRegistry   type: 'tag' }
33 silly mapToRegistry uri http://skimdb.npmjs.com/registry/request
34 verbose addNameRange registry:http://skimdb.npmjs.com/registry/request not in flight; fetching
35 silly cache add args [ 'ws@*', null ]
36 verbose cache add spec ws@*
37 silly cache add parsed spec Result {
37 silly cache add   raw: 'ws@*',
37 silly cache add   scope: null,
37 silly cache add   name: 'ws',
37 silly cache add   rawSpec: '*',
37 silly cache add   spec: '*',
37 silly cache add   type: 'range' }
38 silly addNamed ws@*
39 verbose addNamed "*" is a valid semver range for ws
40 silly addNameRange { name: 'ws', range: '*', hasData: false }
41 silly mapToRegistry name ws
42 silly mapToRegistry using default registry
43 silly mapToRegistry registry http://skimdb.npmjs.com/registry
44 silly mapToRegistry data Result {
44 silly mapToRegistry   raw: 'ws',
44 silly mapToRegistry   scope: null,
44 silly mapToRegistry   name: 'ws',
44 silly mapToRegistry   rawSpec: '',
44 silly mapToRegistry   spec: 'latest',
44 silly mapToRegistry   type: 'tag' }
45 silly mapToRegistry uri http://skimdb.npmjs.com/registry/ws
46 verbose addNameRange registry:http://skimdb.npmjs.com/registry/ws not in flight; fetching
47 silly cache add args [ 'mocha@*', null ]
48 verbose cache add spec mocha@*
49 silly cache add parsed spec Result {
49 silly cache add   raw: 'mocha@*',
49 silly cache add   scope: null,
49 silly cache add   name: 'mocha',
49 silly cache add   rawSpec: '*',
49 silly cache add   spec: '*',
49 silly cache add   type: 'range' }
50 silly addNamed mocha@*
51 verbose addNamed "*" is a valid semver range for mocha
52 silly addNameRange { name: 'mocha', range: '*', hasData: false }
53 silly mapToRegistry name mocha
54 silly mapToRegistry using default registry
55 silly mapToRegistry registry http://skimdb.npmjs.com/registry
56 silly mapToRegistry data Result {
56 silly mapToRegistry   raw: 'mocha',
56 silly mapToRegistry   scope: null,
56 silly mapToRegistry   name: 'mocha',
56 silly mapToRegistry   rawSpec: '',
56 silly mapToRegistry   spec: 'latest',
56 silly mapToRegistry   type: 'tag' }
57 silly mapToRegistry uri http://skimdb.npmjs.com/registry/mocha
58 verbose addNameRange registry:http://skimdb.npmjs.com/registry/mocha not in flight; fetching
59 silly cache add args [ 'docco@*', null ]
60 verbose cache add spec docco@*
61 silly cache add parsed spec Result {
61 silly cache add   raw: 'docco@*',
61 silly cache add   scope: null,
61 silly cache add   name: 'docco',
61 silly cache add   rawSpec: '*',
61 silly cache add   spec: '*',
61 silly cache add   type: 'range' }
62 silly addNamed docco@*
63 verbose addNamed "*" is a valid semver range for docco
64 silly addNameRange { name: 'docco', range: '*', hasData: false }
65 silly mapToRegistry name docco
66 silly mapToRegistry using default registry
67 silly mapToRegistry registry http://skimdb.npmjs.com/registry
68 silly mapToRegistry data Result {
68 silly mapToRegistry   raw: 'docco',
68 silly mapToRegistry   scope: null,
68 silly mapToRegistry   name: 'docco',
68 silly mapToRegistry   rawSpec: '',
68 silly mapToRegistry   spec: 'latest',
68 silly mapToRegistry   type: 'tag' }
69 silly mapToRegistry uri http://skimdb.npmjs.com/registry/docco
70 verbose addNameRange registry:http://skimdb.npmjs.com/registry/docco not in flight; fetching
71 silly cache add args [ 'sharp@git://github.com/lovell/sharp.git#quill', null ]
72 verbose cache add spec sharp@git://github.com/lovell/sharp.git#quill
73 verbose request uri http://skimdb.npmjs.com/registry/cheerio
74 verbose request no auth needed
75 info attempt registry request try #1 at 12:23:12 AM
76 verbose request id a3bd45a86e245dd4
77 http request GET http://skimdb.npmjs.com/registry/cheerio
78 verbose request uri http://skimdb.npmjs.com/registry/request
79 verbose request no auth needed
80 info attempt registry request try #1 at 12:23:12 AM
81 http request GET http://skimdb.npmjs.com/registry/request
82 verbose request uri http://skimdb.npmjs.com/registry/ws
83 verbose request no auth needed
84 info attempt registry request try #1 at 12:23:12 AM
85 http request GET http://skimdb.npmjs.com/registry/ws
86 verbose request uri http://skimdb.npmjs.com/registry/mocha
87 verbose request no auth needed
88 info attempt registry request try #1 at 12:23:12 AM
89 http request GET http://skimdb.npmjs.com/registry/mocha
90 verbose request uri http://skimdb.npmjs.com/registry/docco
91 verbose request no auth needed
92 info attempt registry request try #1 at 12:23:12 AM
93 http request GET http://skimdb.npmjs.com/registry/docco
94 silly cache add parsed spec Result {
94 silly cache add   raw: 'sharp@git://github.com/lovell/sharp.git#quill',
94 silly cache add   scope: null,
94 silly cache add   name: 'sharp',
94 silly cache add   rawSpec: 'git://github.com/lovell/sharp.git#quill',
94 silly cache add   spec: 'git://github.com/lovell/sharp.git#quill',
94 silly cache add   type: 'hosted',
94 silly cache add   hosted:
94 silly cache add    { type: 'github',
94 silly cache add      ssh: 'git@github.com:lovell/sharp.git#quill',
94 silly cache add      sshUrl: 'git+ssh://git@github.com/lovell/sharp.git#quill',
94 silly cache add      httpsUrl: 'git+https://github.com/lovell/sharp.git#quill',
94 silly cache add      gitUrl: 'git://github.com/lovell/sharp.git#quill',
94 silly cache add      shortcut: 'github:lovell/sharp#quill',
94 silly cache add      directUrl: 'https://raw.githubusercontent.com/lovell/sharp/quill/package.json' } }
95 verbose addRemoteGit caching git://github.com/lovell/sharp.git#quill
96 verbose addRemoteGit git://github.com/lovell/sharp.git#quill is a repository hosted by github
97 silly tryClone cloning git://github.com/lovell/sharp.git#quill via git://github.com/lovell/sharp.git#quill
98 verbose tryClone git-github-com-lovell-sharp-git-bf06b9fd not in flight; caching
99 verbose correctMkdir C:\Users\----\AppData\Roaming\npm-cache\_git-remotes correctMkdir not in flight; initializing
100 verbose makeDirectory C:\Users\----\AppData\Roaming\npm-cache\_git-remotes creation not in flight; initializing
101 verbose makeCacheDir UID & GID are irrelevant on win32
102 info git [ 'clone',
102 info git   '--template=C:\\Users\\----\\AppData\\Roaming\\npm-cache\\_git-remotes\\_templates',
102 info git   '--mirror',
102 info git   'git://github.com/lovell/sharp.git',
102 info git   'C:\\Users\\----\\AppData\\Roaming\\npm-cache\\_git-remotes\\git-github-com-lovell-sharp-git-bf06b9fd' ]
103 http 200 http://skimdb.npmjs.com/registry/request
104 verbose headers { 'cache-control': 'must-revalidate',
104 verbose headers   connection: 'close',
104 verbose headers   'content-type': 'application/json',
104 verbose headers   date: 'Tue, 18 Oct 2016 23:23:11 GMT',
104 verbose headers   server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)',
104 verbose headers   'transfer-encoding': 'chunked',
104 verbose headers   'content-encoding': 'gzip',
104 verbose headers   'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' }
105 silly get cb [ 200,
105 silly get   { 'cache-control': 'must-revalidate',
105 silly get     connection: 'close',
105 silly get     'content-type': 'application/json',
105 silly get     date: 'Tue, 18 Oct 2016 23:23:11 GMT',
105 silly get     server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)',
105 silly get     'transfer-encoding': 'chunked',
105 silly get     'content-encoding': 'gzip',
105 silly get     'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' } ]
106 verbose get saving undefined to C:\Users\----\AppData\Roaming\npm-cache\skimdb.npmjs.com\registry\request\.cache.json
107 verbose correctMkdir C:\Users\----\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
108 http 200 http://skimdb.npmjs.com/registry/cheerio
109 verbose headers { 'cache-control': 'must-revalidate',
109 verbose headers   connection: 'close',
109 verbose headers   'content-type': 'application/json',
109 verbose headers   date: 'Tue, 18 Oct 2016 23:23:11 GMT',
109 verbose headers   server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)',
109 verbose headers   'transfer-encoding': 'chunked',
109 verbose headers   'content-encoding': 'gzip',
109 verbose headers   'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' }
110 silly get cb [ 200,
110 silly get   { 'cache-control': 'must-revalidate',
110 silly get     connection: 'close',
110 silly get     'content-type': 'application/json',
110 silly get     date: 'Tue, 18 Oct 2016 23:23:11 GMT',
110 silly get     server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)',
110 silly get     'transfer-encoding': 'chunked',
110 silly get     'content-encoding': 'gzip',
110 silly get     'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' } ]
111 verbose get saving undefined to C:\Users\----\AppData\Roaming\npm-cache\skimdb.npmjs.com\registry\cheerio\.cache.json
112 verbose correctMkdir C:\Users\----\AppData\Roaming\npm-cache correctMkdir already in flight; waiting
113 http 200 http://skimdb.npmjs.com/registry/ws
114 verbose headers { 'cache-control': 'must-revalidate',
114 verbose headers   connection: 'close',
114 verbose headers   'content-type': 'application/json',
114 verbose headers   date: 'Tue, 18 Oct 2016 23:23:11 GMT',
114 verbose headers   server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)',
114 verbose headers   'transfer-encoding': 'chunked',
114 verbose headers   'content-encoding': 'gzip',
114 verbose headers   'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' }
115 silly get cb [ 200,
115 silly get   { 'cache-control': 'must-revalidate',
115 silly get     connection: 'close',
115 silly get     'content-type': 'application/json',
115 silly get     date: 'Tue, 18 Oct 2016 23:23:11 GMT',
115 silly get     server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)',
115 silly get     'transfer-encoding': 'chunked',
115 silly get     'content-encoding': 'gzip',
115 silly get     'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' } ]
116 verbose get saving undefined to C:\Users\----\AppData\Roaming\npm-cache\skimdb.npmjs.com\registry\ws\.cache.json
117 verbose correctMkdir C:\Users\----\AppData\Roaming\npm-cache correctMkdir already in flight; waiting
118 http 200 http://skimdb.npmjs.com/registry/docco
119 verbose headers { 'cache-control': 'must-revalidate',
119 verbose headers   connection: 'close',
119 verbose headers   'content-type': 'application/json',
119 verbose headers   date: 'Tue, 18 Oct 2016 23:23:11 GMT',
119 verbose headers   server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)',
119 verbose headers   'transfer-encoding': 'chunked',
119 verbose headers   'content-encoding': 'gzip',
119 verbose headers   'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' }
120 silly get cb [ 200,
120 silly get   { 'cache-control': 'must-revalidate',
120 silly get     connection: 'close',
120 silly get     'content-type': 'application/json',
120 silly get     date: 'Tue, 18 Oct 2016 23:23:11 GMT',
120 silly get     server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)',
120 silly get     'transfer-encoding': 'chunked',
120 silly get     'content-encoding': 'gzip',
120 silly get     'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' } ]
121 verbose get saving undefined to C:\Users\----\AppData\Roaming\npm-cache\skimdb.npmjs.com\registry\docco\.cache.json
122 verbose correctMkdir C:\Users\----\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
123 http 200 http://skimdb.npmjs.com/registry/mocha
124 verbose headers { 'cache-control': 'must-revalidate',
124 verbose headers   connection: 'close',
124 verbose headers   'content-type': 'application/json',
124 verbose headers   date: 'Tue, 18 Oct 2016 23:23:11 GMT',
124 verbose headers   server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)',
124 verbose headers   'transfer-encoding': 'chunked',
124 verbose headers   'content-encoding': 'gzip',
124 verbose headers   'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' }
125 silly get cb [ 200,
125 silly get   { 'cache-control': 'must-revalidate',
125 silly get     connection: 'close',
125 silly get     'content-type': 'application/json',
125 silly get     date: 'Tue, 18 Oct 2016 23:23:11 GMT',
125 silly get     server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)',
125 silly get     'transfer-encoding': 'chunked',
125 silly get     'content-encoding': 'gzip',
125 silly get     'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' } ]
126 verbose get saving undefined to C:\Users\----\AppData\Roaming\npm-cache\skimdb.npmjs.com\registry\mocha\.cache.json
127 verbose correctMkdir C:\Users\----\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
128 silly addNameRange number 2 { name: 'ws', range: '*', hasData: true }
129 silly addNameRange versions [ undefined, [] ]
130 verbose stack TypeError: Cannot read property 'latest' of undefined
130 verbose stack     at next (C:\Program Files\nodejs\node_modules\npm\lib\cache\add-named.js:248:35)
130 verbose stack     at setData (C:\Program Files\nodejs\node_modules\npm\lib\cache\add-named.js:236:5)
130 verbose stack     at RES (C:\Program Files\nodejs\node_modules\npm\node_modules\inflight\inflight.js:23:14)
130 verbose stack     at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:17:25)
130 verbose stack     at fixName (C:\Program Files\nodejs\node_modules\npm\lib\cache\add-named.js:29:5)
130 verbose stack     at saved (C:\Program Files\nodejs\node_modules\npm\lib\cache\caching-client.js:173:7)
130 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:210:7
130 verbose stack     at FSReqWrap.oncomplete (fs.js:82:15)
131 verbose cwd C:\Users\----\Desktop\----
132 error Windows_NT 6.3.9600
133 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
134 error node v4.6.1
135 error npm  v2.15.9
136 error Cannot read property 'latest' of undefined
137 error If you need help, you may report this error at:
137 error     <https://github.com/npm/npm/issues>
138 verbose exit [ 1, true ]
zkat commented 7 years ago

🤔 why is you registry set to http://skimdb.npmjs.com/registry?

What happens if you do npm install --registry https://registry.npmjs.org?