Problem installing in RPi3: onoff library and later

OK, @vshymanskyy I cleared out all remnants of node, nodejs & npm that I could find, including any in /opt and /usr/bin, so I could start from relative scratch. I did not remove any Blynk directories as I didn’t know which ones were related to my wiringPi install.

I then re-ran through your entire list of commands again… and the only warnings were at the very last install…

root@raspberrypi:~# npm install -g blynk-library onoff
/opt/nodejs/bin/blynk-client -> /opt/nodejs/lib/node_modules/blynk-library/bin/blynk-client.js
/opt/nodejs/bin/blynk-ctrl -> /opt/nodejs/lib/node_modules/blynk-library/bin/blynk-ctrl.js

> epoll@0.1.20 install /opt/nodejs/lib/node_modules/onoff/node_modules/epoll
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.9.5"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/opt/nodejs/lib/node_modules/onoff/node_modules/epoll/.node-gyp"
make: Entering directory '/opt/nodejs/lib/node_modules/onoff/node_modules/epoll/build'
  CXX(target) Release/obj.target/epoll/src/epoll.o
  SOLINK_MODULE(target) Release/obj.target/epoll.node
  COPY Release/epoll.node
make: Leaving directory '/opt/nodejs/lib/node_modules/onoff/node_modules/epoll/build'
/opt/nodejs/lib
├── blynk-library@0.4.5
└─┬ onoff@1.1.1
  └─┬ epoll@0.1.20
    ├── bindings@1.2.1
    └── nan@2.4.0

Unfortunately, after running the blynk-client <auth> command, I still have the same null result… no errors or delays before jumping back to the CLI prompt.

@Gunner I did it on my Raspberry PI Model B without mounting holes from 2012 - and it works.
run these commands and show your output:

uname -m
uname -a
cat /etc/os-release
cat /etc/debian_version
cat /proc/cpuinfo
echo $PATH
echo $NODE_PATH
node --version
npm -v

P.S. I did a clean install of 2017-01-11-raspbian-jessie, expanded image, enabled VNC and SSH if that can matter

You can also try:
npm install -g npm
and then reinstall blynk and onoff
I will take looooots of time…

Which one of the symbolic links above, if any, allows us to use commands without the .js suffix i.e.

blynk-client <token>

rather than

blynk-client.js <token>

None. npm setups the links itself

1 Like
pi@raspberrypi:/ $ uname -m
armv6l

pi@raspberrypi:/ $ uname -a
Linux raspberrypi 4.4.32-aufs #1 Sat Nov 19 00:02:41 CET 2016 armv6l GNU/Linux

pi@raspberrypi:/ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

pi@raspberrypi:/ $ cat /etc/debian_version
8.0

pi@raspberrypi:/ $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 897.37
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 000f
Serial          : 00000000120d3228

pi@raspberrypi:/ $ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/opt/nodejs/bin/:/opt/nodejs/bin/:/opt/nodejs/bin/

pi@raspberrypi:/ $ echo $NODE_PATH
/usr/local/lib/node_modules

pi@raspberrypi:/ $ node --version
v6.9.5

pi@raspberrypi:/ $ npm -v
3.10.10

Full or Lite?

@vshymanskyy and @Gunner I started with a fresh install of Jessie Lite today. After a couple of hours I was almost up and running when the SD card gave systemd errors on bootup. The card wasn’t failing and I tried for a few hours to fix it but no joy.

Tried a second time but this time decided I would install the filesystem to a USB stick and all seems to be fine. Still need to check out my DS18B20 setup but basic operation is fine.

Guide for USB filesystem is at https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=44177
It looks detailed but it’s not really that bad. @paulv wrote it in 2013 but updated it just a couple of weeks ago.

I made a few notes during the Blynk setup but basically they are as published by @vshymanskyy a few posts back.

I’m not getting a $NODE_PATH with your instructions.
The following will retain the nodejs path between reboots on a Pi

echo 'export PATH=$PATH:/opt/nodejs/bin/'  >> ~/.bashrc

Put your version checks into a script and this is what I get, third line from the bottom is the missing $NODE_PATH. Everything works fine as it is but it does mean some of my scripts need full path details before they will run. It would be nice to have a $NODE_PATH if you have a fix.

armv6l
Linux raspberrypi 4.4.38+ #938 Thu Dec 15 15:17:54 GMT 2016 armv6l GNU/Linux
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
8.0
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 000e
Serial          : 00000000f29267b3
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/opt/nodejs/bin/

v6.9.5
4.2.0

@Gunner, $NODE_PATH is invalid in your case. Either set it to new path, or remove it completely from environment.

@vshymanskyy what is the command to set up the correct $NODE_PATH based on the /opt/ installation?

That wouldn’t surprise me… all the different PATH commands I have dropped in… I am just a copy/paste linux user (thank heavens CLI remembers past commands :wink: ), but I will Google yet some more and give it a try…

OK, after taking some time away from this RPi hassle… I am back where I think everything is installed, but running blynk-client <auth> results in absolutely nothing. If I don’t have the correct path, how come no error is thrown?

echo $PATH gets me this:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/opt/nodejs/bin/:/opt/nodejs/bin/

echo $NODE_PATH is blank…

So what am I actually to do now?? After Googling, I think? I understand a bit about adding a path, but what is the correct path to add??

Also, @Costas did give me a mod for the blynk-node.js file, to set it up for my Local Server, but that is more a semi-permanent thing… so even if it is a pain to switch back and forth between Cloud and Local, what parameters do I use with blynk-client <auth> to get it to connect to my local server instead of Cloud?

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

@Gunner please check the “Creating a new Node.js project with Blynk” section

I am installing nodejs right now… where is this other section hiding?

In the middle of the article :wink:
This is an option that does not require NODE_PATH setup, so should work for you. Tell me if it helps. Thx

Ah… now he wants me to actually READ the articles… fine, I guess I will :stuck_out_tongue_winking_eye:

Try this … it worked for me on rapsberry pi 3 B

Download and build Blynk JS library using npm:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential npm

run as root

sudo su
sudo npm install -g npm
sudo npm install -g onoff
sudo npm install -g blynk-library

exit

exit

Thanks @bb8 But try to check the Time/Date stamps before posting as this is an older topic and much has been updated in the libraries, documents, etc, since.

1 - http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/raspberry-pi/raspberry-pi-and-blynk

2 - http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/raspberry-pi/blynk-and-raspberry-pi-tips-tricks

3 - http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/raspberry-pi/how-to-install-nodejs-library-on-linux