Open jessb321 opened 8 years ago
Could you give a bit of info on what kind of situation it was? Ie. what would be really useful is, did you run a 'david' or 'david -g'
(The -g switch looks for globally installed packages, while plain 'david' will check for local packages under your current folder)
I could home in on this. Sounds interesting!
Btw, what does 'david --version' say at the moment?
I ran a david -g
, and the version says v9.0.0
edit: regular david works fine
Thanks for info!
I think have a couple of ideas for where to look for the bug.
Got 9.0.0 here too, checking it out further.
I got probably closer to solving this one. A bit of help testing out would be needed :) The problem with debugging has been that I cannot directly replicate that bug which was mentioned originally in the top of this thread.
However, what I got right now (not yet a pull request) is debug messaging for reporting on how the code behaves for packages. I'm suspecting a section of code in the lib/david.js having trouble with objects coming out to be sorted, which haven't for some reason inherited the .sort as part of Object prototype. In the code, it's the "data" variable. The object comes out as a result from a call to npm view
⬢ ~ npm i -g david
/usr/local/bin/david -> /usr/local/lib/node_modules/david/bin/david.js
+ david@11.0.0
updated 1 package in 4.375s
⬢ ~ david -g
module.js:487
throw err;
^
Error: Cannot find module 'pinkie-promise'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/david/node_modules/npm/node_modules/request/node_modules/har-validator/lib/index.js:3:15)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
⬢ ~ cd /usr/local/lib/node_modules/david/node_modules
⬢ node_modules npm i --verbose pinkie-promise
⬢ node_modules david -g
/usr/local/lib/node_modules/david/lib/npm.js:40
versions = data[currentVersion].versions.sort(function (a, b) {
^
TypeError: data[currentVersion].versions.sort is not a function
at /usr/local/lib/node_modules/david/lib/npm.js:40:50
at /usr/local/lib/node_modules/david/node_modules/npm/lib/view.js:152:28
at saved (/usr/local/lib/node_modules/david/node_modules/npm/lib/cache/caching-client.js:174:7)
at /usr/local/lib/node_modules/david/node_modules/npm/node_modules/graceful-fs/polyfills.js:261:18
at FSReqWrap.oncomplete (fs.js:135:15)
⬢ node_modules david --version
v11.0.0
⬢ node_modules node -v
v8.1.2
⬢ node_modules npm -v
5.0.3
Tried uninstalling and reinstalling, heres the error