[Solved] Issues setting up onoff module on RPi - invalid version of Node.js?

I am trying to install Blynk on my RPi B ver 2.0. And while I can connect, I am unable to control any GPIO pins as I get the following error:

No direct pin operations available.
Maybe you need to install mraa or onoff modules?

I am suspecting an issue with installing the onoff module due to getting this error when following the initial instructions on this site:

pi@raspberrypi:~ $ sudo npm install -g onoff
npm WARN npm npm does not support Node.js v0.12.6
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can’t make any promises that npm will work with this version.
npm WARN npm You can find the latest version at https://nodejs.org/
└── onoff@1.1.1

Any suggestions?

Please un-install “node” or/and “nodejs” pakages (or the whole raspbian image) and install latest node:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y build-essential nodejs

I think I uninstalled everything correctly…

sudo apt-get --purge remove node
sudo apt-get --purge remove nodejs
sudo apt-get --purge remove node.js

But got this error when installing latest node as recommended:
pi@raspberrypi:~ $ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

## Installing the NodeSource Node.js v6.x repo…

## You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by the NodeSource Linux distributions. Please use the ‘linux-armv6l’ binary tarballs available directly from nodejs.org for Node.js v4 and later.

I have downloaded what I think is the correct file to my Pi, but haven’t a clue how to install it:

EDIT!! OK, I found some directions on Google and edited them to match the “proper?” version… I ran these instructions… but still not really understanding what I just did :slight_smile:

 wget https://nodejs.org/dist/v6.9.1/node-v6.9.1-linux-armv6l.tar.gz
 tar -xvf node-v6.9.1-linux-armv6l.tar.gz
 cd node-v6.9.1-linux-armv6l
 sudo cp -R * /usr/local/

Final EDIT!! Well, I initially had issues with the above commands… as I had not ran them one after another, thus the last one was not in the proper directory (as it would have been if all were ran sequentially)… so I re-ran the commands as listed above and am now going through the rest of the NPM, ONOFF and Blynk library install… we will see if this all works out in the end :stuck_out_tongue:

OK, much thanks to vhymanskyy, who’s answer led me on a path of discovery, baby steps and face-plants… but eventual success :wink:

Now I can be "poken da buttons and blinkin da lightens!!"

And so, at least for my older RPi B ver2.0, these are the working steps to get Blynk installed AND functional:

wget https://nodejs.org/dist/v6.9.1/node-v6.9.1-linux-armv6l.tar.gz
tar -xvf node-v6.9.1-linux-armv6l.tar.gz
cd node-v6.9.1-linux-armv6l
sudo cp -R * /usr/local/
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential
sudo npm install -g npm
sudo npm install -g onoff
sudo npm install -g blynk-library

Hope this helps someone else as well!! :grinning:

1 Like

Please check our latest guide on Node.js installation for Linux: http://help.blynk.cc/hardware-and-libraries/node-js/how-to-install-nodejs-library-on-linux