nfarina / homebridge-sonos

Sonos plugin for homebridge: https://github.com/nfarina/homebridge
153 stars 52 forks source link

Error after running homebridge command #10

Closed cneb1 closed 8 years ago

cneb1 commented 8 years ago

Mac OS X platform, ran the npm install -g homebridge-sonos command, then ran npm install -g home bridge-sonos@0.0.3 command, then ran homebridge command, and the following spits out:

ERROR LOADING PLUGIN homebridge-sonos: Error: Cannot find module 'underscore' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:289:25) at Module.require (module.js:366:17) at require (module.js:385:17) at Object. (/usr/local/lib/node_modules/homebridge-sonos/index.js:2:9) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:313:12) at Module.require (module.js:366:17) at require (module.js:385:17) at Plugin.load (/usr/local/lib/node_modules/homebridge/lib/plugin.js:65:22) at Server. (/usr/local/lib/node_modules/homebridge/lib/server.js:70:14) at Array.forEach (native) at Server._loadPlugins (/usr/local/lib/node_modules/homebridge/lib/server.js:66:22) at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:24:24)

My Nest device is fetched properly, but after the Nest device in Terminal I also see this:

/usr/local/lib/node_modules/homebridge/lib/api.js:88 throw new Error("The requested platform '" + name + "' was not registered by any plugin."); ^

Error: The requested platform 'Sonos' was not registered by any plugin. at API.platform (/usr/local/lib/node_modules/homebridge/lib/api.js:88:13) at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:194:45) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:35:36) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:23:16) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:313:12) at Function.Module.runMain (module.js:467:10) at startup (node.js:136:18) at node.js:963:3

Sonos in home consists of the bridge, a Sonos Amp, and 2 Sonos 1 devices. I only want to control the living room so my config.js file has the following after the Nest device:

}, { "platform": "Sonos", "name": "Living Room", "room": "Dining Room" }] }

Config.js file validates, at a loss. Any help appreciated. Would love to control my Sonos Amp in the living room when cooking or making meals for my daughter.

Dave10950 commented 8 years ago

I also have the same problem, the error I get seems - to me - identical. And I also have some issue getting Nest to work, but WeMo seems to be working fine.

Attached Homebridge sonos errors.pdf

are the errors;

Any help would be greatly appreciated. Thank you

benjiman1985 commented 8 years ago

Hi,

Same problem here. A fix would be appreciated :)

Nousemusic commented 8 years ago

Same issues here, see comment https://github.com/nfarina/homebridge-sonos/issues/4#issuecomment-172212991.

Thank you for your help in advance.

fwboettger commented 8 years ago

Seems to be related to the dependency to the underscore package introduced with version 0.0.3 (as the message "Error: Cannot find module 'underscore'" indicates).

I'm a complete newbie to the npm environment, not sure really what needs to be done to have this automated; while coming up with the stuff for the pull request leading eventually to version 0.0.3, i manually installed underscore via "npm install -g underscore" - i thus suppose doing this manually for the time being as a work around would resolve this issue.

@nfarina - would be great if you could help with this matter as well for the npm package (don't have the slightest clue really, actually assumed that this dependency would be discovered and reflected accordingly more or less automatically with npm).... Apologies if this would be coming down to an oversight on my site!

Dave10950 commented 8 years ago

I don't know what changed but mine suddenly started working, except for one speaker that it just doesn't want to find, and that Siri can't control the volume of the speakers.

fwboettger commented 8 years ago

@Dave10950 - could you quickly summarise your homesetup (which sonos devices, including bridges/connects/Amp if applicable, and in which 'room' (as per your sonos app configuration)) as well as share your config.json? That's be tremendously helpful to support further with your latest comment....

nfarina commented 8 years ago

Looks like the author of the last PR forgot to add the underscore dependency in package.json. I just pushed a fix and published a version update for that.