BlinkStick with Node-webkit 0.8.6 - Ubuntu 12 LTS 32 Bit / NOK

I am triing to make it work with Node webkit 0.8.6 - Based off on onde 0.10.22 .
i get this error :smile:

Uncaught Error: /home/youri/node-webkit-v0.8.6-linux-ia32/poc/node_modules/blinkstick/node_modules/usb/build/Release/usb_bindings.node: undefined symbol: _ZN2v86String3NewEPKci

I am quiet desperated about using blinkstick with a nodewebkit project : (

I’m currently trying to reproduce the issue you reported.

I got it to work with the latest version of all software bits on Ubuntu 12 LTS, but it should work with newer versions of Ubuntu too:

Prerequisites

sudo apt-get install libusb-1.0-0-dev libudev-dev libnss3 build-essential

Install Node.js

Download source tarbal, extract it and run:

./configure
make
sudo make install

You can also install the binaries available.

Install NW.js

I just downloaded the 0.12.0 version and extracted it under home folder ~/nw for simplicity

Install nw-gyp

Please follow the nw-gyp installation instructions if required. For me it was sufficient to run this command:

sudo npm install -g nw-gyp

Basic sample

mkdir ~/nw_blinkstick
cd ~/nw_blinkstick

Create file ~/nw_blinkstick/index.html

<!DOCTYPE html>
<html>
  <head>
    <title>Hello World!</title>
  </head>
  <body>
    <h1>Hello World!</h1>
    We are using node.js <script>document.write(process.version)</script>.

    <script>
        var blinkstick = require('blinkstick'),
            device = blinkstick.findFirst();

        if (device) {
            var finished = false;
            var ledCount = 7;
            var index = 0;

            var setColor = function () {
                console.log(index);
                device.setColor("random", {'channel':0, 'index':index}, function() {
                    if (index == ledCount) {
                        finished = true;
                    } else {
                        index += 1;
                        setTimeout(setColor, 200);
                    }
                });
            }

            setColor();

            var wait = function () { if (!finished) setTimeout(wait, 100)}
            wait();
        }

    </script>
  </body>
</html>

Create file ~/nw_blinkstick/package.json

{
    "name": "nw-demo",
    "main": "index.html"
}

Now you need to install Node.js package for BlinkStick

cd ~/nw_blinkstick
npm install blinkstick

Important: You have to recompile usb package for NW.js. That’s why you need to install nw-gyp in one of the previous steps.

cd node_modules/blinkstick/node_modules/usb
nw-gyp configure --target=0.12.0
nw-gyp build

Now go back to the sample folder and run the example. Please use sudo if you get permission denied error.

cd ~/nw_blinkstick
sudo ~/nw/nw .

LMK if something does not work and I will be happy to help.

Really really great
Thank you for your help !

Regards,
YP