0

I'm currently working on a class project dealing with MPD and I'm attempting to use Komponist. I'm running into an issue when trying to connect to my currently running MPD server.

Here I have the following code that just attempts to create a connection to my MPD server.

var komponist = require('komponist');

var client = komponist.createConnection(6600, 'localhost', function() {
  console.log('Connected!');
});

However, when I try to execute this code the Chrome debugger's returning "Cannot read property 'apply' of undefined " and it's pointing to this:

MPDClient.prototype.connect = function() {
    var returnVal = MPDClient.super_.prototype.connect.apply(this, arguments); //This line
    this.write = MPDClient.prototype.write;
    return returnVal;
}

At first I thought it was because MPD simply wasn't running or there was a connection issue but my MPD server is running on localhost:6600 and I can connect to it just fine from another third party client, so I'm wondering if I'm missing a library or some other dev dependencies to use komponist. I'm not familiar with the "super_" notation.

This shouldn't matter but I'm using Windows, so it's a Windows binary of MPD. My version of Node is 0.10.31

Or, if anybody else has any good recommendations for an existing JavaScript MPD client throw them my way.

Andrew Bowler
  • 93
  • 1
  • 2
  • 7
  • What version of Node are you using? – loganfsmyth Oct 21 '14 at 05:40
  • My Node version is 0.10.31 – Andrew Bowler Oct 21 '14 at 17:40
  • Wait, I'm confused, you said `Chrome debugger`, if you are using Node, how does Chrome factor into this? – loganfsmyth Oct 21 '14 at 18:15
  • Chrome is simply the browser I'm testing my webpage in that executes this code. From what I understand, `super_.` is a Node thing, and the browser is unable to find that property. It has access to both parameters `(this, arguments)`. – Andrew Bowler Oct 21 '14 at 18:42
  • The second block of code is something that I didn't write, that came in the `komponist` module I downloaded from `npm` – Andrew Bowler Oct 21 '14 at 18:43
  • Firefox also displays `MPDClient.super_.prototype.connect is undefined` – Andrew Bowler Oct 21 '14 at 18:56
  • To be clear, what I would expect is that Chrome connects to a server running in Node, e.g. http://localhost:8000 or something and Node would be running `express` or something like that, and then `express` would run the code your have posted in Node. Is that what you are doing? Pasting this code into Chrome's console, or in a JS file included in an HTML file will absolutely not work. However if I open up a Node terminal window and run the code you have posted, it works fine. – loganfsmyth Oct 21 '14 at 19:03

0 Answers0