jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.85k stars 460 forks source link

Can't Seem To Get This To Work #111

Closed kjon12 closed 8 years ago

kjon12 commented 8 years ago

I made a git clone of this api and installed it on a Raspberry Pi (12/21/2015). I then did an "npm install --production", which appeared to run OK, followed by an "npm start". This errors out and I really don't know why. Attached is the debug log. Can someone tell me what I'm doing wrong?

rename the following to a ".doc" and it will display better as a word file.

npm-debug.txt

jishi commented 8 years ago

Weird error, but it requires node 4+ to run which would be a good start. There are precompiled versions for ARM on the nodejs homepage. That's a good start in troubleshooting this.

kjon12 commented 8 years ago

Thanks for the reply. Where is this nodejs page? Is there a specific arm compile to look for? I think the raspberry pi is an arm11 variant. On Dec 21, 2015 3:56 PM, "Jimmy Shimizu" notifications@github.com wrote:

Weird error, but it requires node 4+ to run which would be a good start. There are precompiled versions for ARM on the nodejs homepage. That's a good start in troubleshooting this.

— Reply to this email directly or view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/111#issuecomment-166462199 .

NovaGL commented 8 years ago

Make sure you use the latest v4 of node

I use NVM its the easiest way I believe as it allows different versions to be installed, you might have to compile from source so NVM will do that for you

https://github.com/blobsmith/raspberryTestNode/wiki/Node.js-installation-with-nvm-on-Raspberry-pi

Follow that guide and once installed do nvm install 4.2.3 -s

That ensures that you get a version that works with your hardware.

jishi commented 8 years ago

Raspberry pi 1 (both A and B versions) are based on an armv6 architecture. The pi 2 is based on armv7. If you don't want to use the nvm approach previously suggested, then download the appropriate version here:

https://nodejs.org/en/download/

untar/ungzip it where you deem appropriate (usr/local is usually my choice, the archive contains bin and lib folders) then check to see if the command works. Make sure you remove the old versions or overwrite them since the PATH env variable order will have precedence.

kjon12 commented 8 years ago

Thank you Sir,

I made progress today.  Your server is running, as I was able to do a 'zone' command over my network and received a bunch of stuff back into my browser window which included the names of my Sonos equipment.  Next up is to link this with my Echo.

A couple of noob questions:

1) The "nvm" is a generic version control system for code authors?  Or is it a version control system for node.js only?  

When I did a "nvm install 4.2.3 -s", was I asking for the V4.2.3 of node.js, and if so, what is the -s for?

2) How does npm fit into this?  I don't recall installing npm directly, so I'm guessing it's a command to the node.js system.  When I do a git of your API into a folder, then jump into the folder and do an "npm start", am I telling the node.js software to start your API using instructions it looks for in some file that's part of your API?

Just trying to understand how all of this works.  Thanks! On 12/22/2015 1:01:56 AM, Jimmy Shimizu notifications@github.com wrote: Raspberry pi 1 (both A and B versions) are based on an armv6 architecture. The pi 2 is based on armv7. If you don't want to use the nvm approach previously suggested, then download the appropriate version here: https://nodejs.org/en/download/ [https://nodejs.org/en/download/] untar/ungzip it where you deem appropriate (usr/local is usually my choice, the archive contains bin and lib folders) then check to see if the command works. Make sure you remove the old versions or overwrite them since the PATH env variable order will have precedence. — Reply to this email directly or view it on GitHub [https://github.com/jishi/node-sonos-http-api/issues/111#issuecomment-166558922].

NovaGL commented 8 years ago

1) It's node only. Node Version Management

The -s is for source, the node version might not be available so I always use source to make sure it works.

2) NPM is built into node, it's the Node Package Manager.

Jimmy can answer the rest.

jishi commented 8 years ago

The npm command looks for a file called package.json to identify both dependencies (npm install) or startup scripts (npm start). This is not necessary, but I do use it to avoid bundling external modules with the source. In regards to startup, you could just do "node server.js", but if I have a standardized way of starting it, I can modify the startup options in my package.json easily.