ondras / cyp

Control Your Player: a Web-based MPD client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Server crashes at first request

tincho opened this issue · comments

Hi, I followed the instructions:

npm install
node . 

server starts but on first access to port 8080, it crashes:

1557694931111 'ws2mpd attached to a http server' { address: '::', family: 'IPv6', port: 8080 }
/home/tincho/cyp/node_modules/ws2mpd/commands.js:22
			this._mpd.off("data", this._dataListener);
			          ^

TypeError: this._mpd.off is not a function
    at Welcome._done (/home/tincho/cyp/node_modules/ws2mpd/commands.js:22:14)
    at Welcome._processBuffer (/home/tincho/cyp/node_modules/ws2mpd/commands.js:57:20)
    at Welcome._onData (/home/tincho/cyp/node_modules/ws2mpd/commands.js:16:8)
    at Socket.Command._dataListener.data (/home/tincho/cyp/node_modules/ws2mpd/commands.js:9:37)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at TCP.onread (net.js:601:20)

mpd is running

Node v8.16
Debian 9.9

Right. off is an alias for removeListener and was added in NodeJS 10: https://nodejs.org/dist/latest-v12.x/docs/api/events.html#events_emitter_off_eventname_listener

Does your distribution provide an option to install a newer NodeJS version? According to https://nodejs.org/, 10.15.3 is a currently active/supported LTS.

Hey, thanks!

Sure I can pick another Node version, just didn't know which one :)

I suggest failing to npm install if detected wrong version. See #4

Merged, thanks!