jishi / node-sonos-web-controller

A web based controller for Sonos utilizing web sockets for a native look and feel
MIT License
247 stars 45 forks source link

Does not start with node.js 7.3.0 #58

Closed hexadecagram closed 7 years ago

hexadecagram commented 7 years ago

I get the following error:

% sudo /usr/bin/node /srv/http/node-sonos-web-controller/server.js 
module.js:472
    throw err;
    ^

Error: Cannot find module 'node-static'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/srv/http/node-sonos-web-controller/server.js:3:22)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
jishi commented 7 years ago

Are you sure you have installed the dependencies correctly with npm install?

Does it work if you start it from the actual web controller directory?

On 3 Jan 2017 7:56 AM, "hexadecagram" notifications@github.com wrote:

I get the following error:

% sudo /usr/bin/node /srv/http/node-sonos-web-controller/server.js module.js:472 throw err; ^

Error: Cannot find module 'node-static' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/srv/http/node-sonos-web-controller/server.js:3:22) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-web-controller/issues/58, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBNI9OhSTMY1yTzOGN11Ug2PbRhWtzEks5rOfEVgaJpZM4LZYNd .

hexadecagram commented 7 years ago

I'm installing this on a new machine and forgot the npm install step. When I attempt to run it in the controller directory, it appears to work but I get the following:

% sudo npm install
npm WARN sonos-web-controller@0.14.0 No license field.
% sudo npm update 
npm ERR! Linux 4.4.39-1-lts
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "update"
npm ERR! node v7.3.0
npm ERR! npm  v4.0.5
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/sonos-discovery
npm ERR! 404
npm ERR! 404  'sonos-discovery' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR!     /srv/http/node-sonos-web-controller/npm-debug.log
jishi commented 7 years ago

Weird. Did you get any error during the npm install step? That package is referenced via a github URL, and should have been installed correctly. You could try and install it manually, using the URL in package.json, as a test.

On 3 Jan 2017 8:32 AM, "hexadecagram" notifications@github.com wrote:

I'm installing this on a new machine and forgot the npm install step. When I attempt to run it in the controller directory, it appears to work but I get the following:

% sudo npm install npm WARN sonos-web-controller@0.14.0 No license field. % sudo npm update npm ERR! Linux 4.4.39-1-lts npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "update" npm ERR! node v7.3.0 npm ERR! npm v4.0.5 npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/sonos-discovery npm ERR! 404 npm ERR! 404 'sonos-discovery' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request: npm ERR! /srv/http/node-sonos-web-controller/npm-debug.log

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-web-controller/issues/58#issuecomment-270062583, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBNI8ULFTEEgKvwnW3T1Q_gC720MW6wks5rOfmKgaJpZM4LZYNd .

hexadecagram commented 7 years ago

No errors. npm install just spat out that warning after displaying a tree. Do you want to see npm-debug.log generated by npm update?

Where should I install sonos-discovery? And how would I go about doing it manually?

jishi commented 7 years ago

Aha, you ran npm update. That one tries to update to the latest available version of a dependency, that might not work for that depencency. The install ran without outputting anything, which means it thinks that all deps are filled. Do you still get the same error when trying to start it?

jishi commented 7 years ago

For manually installing the package, just use the url from package.json and use with npm install:

npm install https://github.com/jishi/node-sonos-discovery/archive/v1.1.3.tar.gz

But as I said, it shouldn't be necessary unless npm 4+ has started with some weird behavior, haven't tested that version yet.

hexadecagram commented 7 years ago

Aha, you ran npm update.

Not exactly. Re-read the output here and then this comment more closely. I ran npm install first, which gave me the tree (which I edited out of the output for brevity) followed by the warning and then I ran npm update.

I do see sonos-discovery when I npm ls. It turns out that it was installed with my first run of npm install and I did not need to install it using the URL you provided after all.

% npm ls
└─┬ sonos-discovery@1.1.3

At any rate, the service now starts but there are no Sonos players listed in the left hand pane, which I was experiencing with my other machine. Is there any way to see debug logs?

The warning about the license field also seems to be interfering with my ability to npm uninstall sonos-web-controller.

jishi commented 7 years ago

All logging is sent to stdout. You can increase logging level by starting it with env variable NODE_LOG_LEVEL set to "debug":

NODE_LOG_LEVEL=debug npm start

What are you running this on? If it doesn't find a system, it's usually because of network restrictions.

hexadecagram commented 7 years ago

Duh! This Linux machine is on a different subnet than Sonos. So it's back to the other machine.

As I mentioned, though, the license warning seems to be preventing me from uninstalling or updating with npm, which means both machines are dead in the water, one running node-sonos-web-controller 0.13.0, which is on the correct subnet but fails to start and the other 0.14.0, which starts but is on the wrong subnet.

hexadecagram commented 7 years ago

Okay, I think my newness with node.js is showing. ;-)

I just ran git pull on the old machine, which updated it to 0.14.0, which is reflected in npm ls. I thought npm would install dependencies in some subdirectory off the root but no, they go in ./node_modules apparently.

Everything is working now, and look at that! I see my Sonos devices too!

jishi commented 7 years ago

This software would actually traverse one routing jump if everything is forwarded correctly. However, it's not trivial to get running, depending on your setup. Basically it would require:

multicast forwarding (multiplexing) of UDP 1900 to 239.255.255.250 (or broadcast 255.255.255.255), also allow unicast return traffic on UDP port 1905 (dynamically selected, but 1905 is the first attempt) port forward of TCP 1400 to Sonos network port forward of TCP 3500 from Sonos network (dynamically selected, but 3500 is first attempt, then 3501 if occupied etc)