swissmanu / harmonyhubjs-client

A Node.JS library which allows you to interact with your Logitech Harmony Hub.
https://github.com/swissmanu/harmonyhubjs-client
MIT License
155 stars 42 forks source link

Session.js fails with 'this.connection.listen is not a function' #17

Closed realroywalker closed 8 years ago

realroywalker commented 8 years ago

I have been trying to get this working on my server all evening but it keeps failing when running the example scripts.

I am running on Windows (2012 R2) and installed via npm install harmonyhubjs-client --save, but when I tried to run the example script it barfed about a missing module (debug) so I did npm install debug, and tried again. I had to go through the same procedure for about 5-6 different modules until it stopped complaining, but it now just fails with the following error;

C:\Scripts\node_modules\harmonyhubjs-client\node_modules\node-xmpp-client\lib\session.js:87
    this.connection.listen({
                    ^
TypeError: this.connection.listen is not a function
    at Client.Session._socketConnectionToHost (C:\Scripts\node_modules\harmonyhubjs-client\node_modules\node-xmpp-client\lib\session.js:87:21)
    at Client.Session._setupSocketConnection (C:\Scripts\node_modules\harmonyhubjs-client\node_modules\node-xmpp-client\lib\session.js:52:10)
    at Client.Session (C:\Scripts\node_modules\harmonyhubjs-client\node_modules\node-xmpp-client\lib\session.js:27:10)
    at Client._useStandardConnect (C:\Scripts\node_modules\harmonyhubjs-client\node_modules\node-xmpp-client\lib\Client.js:150:11)
    at Client.connect (C:\Scripts\node_modules\harmonyhubjs-client\node_modules\node-xmpp-client\lib\Client.js:135:8)
    at new Client (C:\Scripts\node_modules\harmonyhubjs-client\node_modules\node-xmpp-client\lib\Client.js:124:46)
    at getIdentity (C:\Scripts\node_modules\harmonyhubjs-client\lib\login\hub.js:26:20)
    at loginToHub (C:\Scripts\node_modules\harmonyhubjs-client\lib\login\hub.js:131:10)
    at login (C:\Scripts\node_modules\harmonyhubjs-client\lib\login\index.js:22:10)
    at getHarmonyClient (C:\Scripts\node_modules\harmonyhubjs-client\lib\index.js:9:10)

Any idea what may have gone wrong? - I'm a bit of a noob using nodejs :)

swissmanu commented 8 years ago

this error comes from the inside of node-xmpp-client. this module provides the communication layer for interacting with the harmony hub.

what version of node and npm are you using? did npm install run successfully without any errors?

realroywalker commented 8 years ago

I am running Node.js 4.2.4 (x86), npm -v returns 2.14.12, and all of the 'npm install' commands didn't show any errors. npm list gives the following output;

harmonyhubjs-client@1.1.7 C:\Scripts\node_modules\harmonyhubjs-client ├─┬ debug@2.2.0 │ └── ms@0.7.1 ├── inherits@2.0.1 ├─┬ lodash.assign@3.2.0 │ ├─┬ lodash._baseassign@3.2.0 │ │ └── lodash._basecopy@3.0.1 │ ├─┬ lodash._createassigner@3.1.1 │ │ ├── lodash._bindcallback@3.0.1 │ │ ├── lodash._isiterateecall@3.0.9 │ │ └── lodash.restparam@3.6.1 │ └─┬ lodash.keys@3.1.2 │ ├── lodash._getnative@3.9.1 │ ├── lodash.isarguments@3.0.4 │ └── lodash.isarray@3.0.4 ├─┬ node-xmpp-client@3.0.0 │ ├── browser-request@0.3.3 │ ├─┬ faye-websocket@0.10.0 │ │ └─┬ websocket-driver@0.6.3 │ │ └── websocket-extensions@0.1.1 │ ├─┬ istanbul@0.4.1 │ │ ├── abbrev@1.0.7 │ │ ├── async@1.5.0 │ │ ├─┬ escodegen@1.7.1 │ │ │ ├── esprima@1.2.5 │ │ │ ├── estraverse@1.9.3 │ │ │ ├── esutils@2.0.2 │ │ │ ├─┬ optionator@0.5.0 │ │ │ │ ├── deep-is@0.1.3 │ │ │ │ ├── fast-levenshtein@1.0.7 │ │ │ │ ├── levn@0.2.5 │ │ │ │ ├── prelude-ls@1.1.2 │ │ │ │ ├── type-check@0.3.2 │ │ │ │ └── wordwrap@0.0.3 │ │ │ └─┬ source-map@0.2.0 │ │ │ └── amdefine@1.0.0 │ │ ├── esprima@2.7.1 │ │ ├─┬ fileset@0.2.1 │ │ │ ├─┬ glob@5.0.15 │ │ │ │ ├─┬ inflight@1.0.4 │ │ │ │ │ └── wrappy@1.0.1 │ │ │ │ └── path-is-absolute@1.0.0 │ │ │ └─┬ minimatch@2.0.10 │ │ │ └─┬ brace-expansion@1.1.2 │ │ │ ├── balanced-match@0.3.0 │ │ │ └── concat-map@0.0.1 │ │ ├─┬ handlebars@4.0.5 │ │ │ ├─┬ optimist@0.6.1 │ │ │ │ ├── minimist@0.0.10 │ │ │ │ └── wordwrap@0.0.3 │ │ │ ├─┬ source-map@0.4.4 │ │ │ │ └── amdefine@1.0.0 │ │ │ └─┬ uglify-js@2.6.1 │ │ │ ├── async@0.2.10 │ │ │ ├── source-map@0.5.3 │ │ │ ├── uglify-to-browserify@1.0.2 │ │ │ └─┬ yargs@3.10.0 │ │ │ ├── camelcase@1.2.1 │ │ │ ├─┬ cliui@2.1.0 │ │ │ │ ├─┬ center-align@0.1.2 │ │ │ │ │ ├─┬ align-text@0.1.3 │ │ │ │ │ │ ├─┬ kind-of@2.0.1 │ │ │ │ │ │ │ └── is-buffer@1.1.0 │ │ │ │ │ │ ├── longest@1.0.1 │ │ │ │ │ │ └── repeat-string@1.5.2 │ │ │ │ │ └── lazy-cache@0.2.7 │ │ │ │ ├─┬ right-align@0.1.3 │ │ │ │ │ └─┬ align-text@0.1.3 │ │ │ │ │ ├─┬ kind-of@2.0.1 │ │ │ │ │ │ └── is-buffer@1.1.0 │ │ │ │ │ ├── longest@1.0.1 │ │ │ │ │ └── repeat-string@1.5.2 │ │ │ │ └── wordwrap@0.0.2 │ │ │ ├─┬ decamelize@1.1.2 │ │ │ │ └── escape-string-regexp@1.0.4 │ │ │ └── window-size@0.1.0 │ │ ├─┬ js-yaml@3.4.6 │ │ │ ├─┬ argparse@1.0.3 │ │ │ │ ├── lodash@3.10.1 │ │ │ │ └── sprintf-js@1.0.3 │ │ │ └── inherit@2.2.2 │ │ ├─┬ mkdirp@0.5.1 │ │ │ └── minimist@0.0.8 │ │ ├── nopt@3.0.6 │ │ ├─┬ once@1.3.3 │ │ │ └── wrappy@1.0.1 │ │ ├── resolve@1.1.6 │ │ ├─┬ supports-color@3.1.2 │ │ │ └── has-flag@1.0.0 │ │ ├─┬ which@1.2.1 │ │ │ └─┬ is-absolute@0.1.7 │ │ │ └── is-relative@0.1.3 │ │ └── wordwrap@1.0.0 │ └── minimist@1.2.0 ├─┬ node-xmpp-core@4.2.0 │ └─┬ ltx@2.2.0 (git+https://github.com/swissmanu/ltx.git#ce9c34cc19319de8e65cad c3e360e8e5c290746d) │ └── inherits@2.0.1 ├── node-xmpp-jid@2.1.0 ├─┬ node-xmpp-stanza@1.1.0 │ └─┬ ltx@2.2.0 (git+https://github.com/swissmanu/ltx.git#ce9c34cc19319de8e65cad c3e360e8e5c290746d) │ └── inherits@2.0.1 ├── q@1.4.1 ├─┬ reconnect-core@1.1.0 │ └── backoff@2.3.0 ├─┬ request@2.67.0 │ ├── aws-sign2@0.6.0 │ ├─┬ bl@1.0.0 │ │ └─┬ readable-stream@2.0.5 │ │ ├── core-util-is@1.0.2 │ │ ├── isarray@0.0.1 │ │ ├── process-nextick-args@1.0.6 │ │ ├── string_decoder@0.10.31 │ │ └── util-deprecate@1.0.2 │ ├── caseless@0.11.0 │ ├─┬ combined-stream@1.0.5 │ │ └── delayed-stream@1.0.0 │ ├── extend@3.0.0 │ ├── forever-agent@0.6.1 │ ├─┬ form-data@1.0.0-rc3 │ │ └── async@1.5.0 │ ├─┬ har-validator@2.0.3 │ │ ├─┬ chalk@1.1.1 │ │ │ ├── ansi-styles@2.1.0 │ │ │ ├── escape-string-regexp@1.0.4 │ │ │ ├─┬ has-ansi@2.0.0 │ │ │ │ └── ansi-regex@2.0.0 │ │ │ ├─┬ strip-ansi@3.0.0 │ │ │ │ └── ansi-regex@2.0.0 │ │ │ └── supports-color@2.0.0 │ │ ├─┬ commander@2.9.0 │ │ │ └── graceful-readlink@1.0.1 │ │ ├─┬ is-my-json-valid@2.12.3 │ │ │ ├── generate-function@2.0.0 │ │ │ ├─┬ generate-object-property@1.2.0 │ │ │ │ └── is-property@1.0.2 │ │ │ ├── jsonpointer@2.0.0 │ │ │ └── xtend@4.0.1 │ │ └─┬ pinkie-promise@2.0.0 │ │ └── pinkie@2.0.1 │ ├─┬ hawk@3.1.2 │ │ ├── boom@2.10.1 │ │ ├── cryptiles@2.0.5 │ │ ├── hoek@2.16.3 │ │ └── sntp@1.0.9 │ ├─┬ http-signature@1.1.0 │ │ ├── assert-plus@0.1.5 │ │ ├─┬ jsprim@1.2.2 │ │ │ ├── extsprintf@1.0.2 │ │ │ ├── json-schema@0.2.2 │ │ │ └── verror@1.3.6 │ │ └─┬ sshpk@1.7.1 │ │ ├── asn1@0.2.3 │ │ ├── assert-plus@0.2.0 │ │ ├─┬ dashdash@1.10.1 │ │ │ └── assert-plus@0.1.5 │ │ ├── ecc-jsbn@0.1.1 │ │ ├── jodid25519@1.0.2 │ │ ├── jsbn@0.1.0 │ │ └── tweetnacl@0.13.2 │ ├── is-typedarray@1.0.0 │ ├── isstream@0.1.2 │ ├── json-stringify-safe@5.0.1 │ ├─┬ mime-types@2.1.8 │ │ └── mime-db@1.20.0 │ ├── node-uuid@1.4.7 │ ├── oauth-sign@0.8.0 │ ├── qs@5.2.0 │ ├── stringstream@0.0.5 │ ├── tough-cookie@2.2.1 │ └── tunnel-agent@0.4.2 └── tls-connect@0.2.2

realroywalker commented 8 years ago

Your comment prompted me to look into how npm is upgraded.. I assumed it would be the latest as I'd installed the latest node.js, but after updating it and then installing the latest version of harmonyhubjs-client (1.1.8) it's working brilliantly!

Many thanks for your work on this, and happy new year!