mozilla / doctorjs

A set of static analysis tools for JavaScript
Other
739 stars 67 forks source link

TypeError: Cannot call method 'sort' of undefined #59

Open exos opened 10 years ago

exos commented 10 years ago

Hi! I'm using vim + tagbar plugin and this use jsctags for generate a tags explorer.

For configure it I folllow this: https://github.com/majutsushi/tagbar/wiki#javascript

But, when I try to open the panel, vim reports this error:

Executed command: "'/usr/bin/jsctags'  -f -  '/tmp/v2XOofL/28.js'"
Command output:
Array.prototype.push called on null or undefined
/usr/lib/node_modules/jsctags/jsctags/ctags/writer.js:89
        this.tags = this.tags.sort(sortfunc);
                              ^
TypeError: Cannot call method 'sort' of undefined
    at Object.exports.TagWriter.Trait.write (/usr/lib/node_modules/jsctags/jsctags/ctags/writer.js:89:31)
    at Object.<anonymous> (/usr/lib/node_modules/jsctags/bin/jsctags.js:269:10)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

I trayed to run this manually:

jsctags -f - gui.js

And the error is the same.

More info:

$ node -v 
v0.10.26
$ npm info jsctags | grep version
npm http GET https://registry.npmjs.org/jsctags
npm http 304 https://registry.npmjs.org/jsctags
  versions: '0.1.0',
  version: '0.1.0',

File with I tryed working: http://paste.kde.org/pfnchcp0f

Sorry my poor english :)

joelburget commented 10 years ago

I get the same. A little extra info: I installed with npm install -g and have some additional output:

joelburget@gorebridge ~/k/perseus> jsctags src
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined
Array.prototype.push called on null or undefined

/usr/local/lib/node_modules/jsctags/jsctags/ctags/writer.js:89
        this.tags = this.tags.sort(sortfunc);
                              ^
TypeError: Cannot call method 'sort' of undefined
    at Object.exports.TagWriter.Trait.write (/usr/local/lib/node_modules/jsctags/jsctags/ctags/writer.js:89:31)
    at Object.<anonymous> (/usr/local/lib/node_modules/jsctags/bin/jsctags.js:269:10)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

Hope that's helpful!

ericlgf819 commented 9 years ago

same issue as this closed thread https://github.com/mozilla/doctorjs/issues/52