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

david -g gives versions.sort error #110

Open
jessb321 opened this issue Jun 24, 2016 · 5 comments
Open

david -g gives versions.sort error #110

jessb321 opened this issue Jun 24, 2016 · 5 comments

Comments

@jessb321
Copy link

Tried uninstalling and reinstalling, heres the error

        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/david.js:79: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:210:7
    at FSReqWrap.oncomplete (fs.js:117:15)```
@jpaulin
Copy link
Contributor

jpaulin commented Sep 9, 2016

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?

@jessb321
Copy link
Author

jessb321 commented Sep 9, 2016

I ran a david -g, and the version says v9.0.0

edit: regular david works fine

@jpaulin
Copy link
Contributor

jpaulin commented Sep 9, 2016

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.

@jpaulin
Copy link
Contributor

jpaulin commented Sep 21, 2016

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 versions

@tomoat
Copy link

tomoat commented Jun 22, 2017

~  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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants