Node and NPM Issues

What’s going on? Could you elaborate and be more clear?

Can it be because I am using a old raspberry pi board? it’s rev2 B.

What do you mean by “it” - please specify the step that is not working with updated tutorial, and how it fails. Thx

Well, it’s vhymanskyy himself. Not everyday do I get to have the co-founder of something respond to one of my board posts. But very cool, thanks for the support.

I did go through your attatched readme file and link to hackster before, and was able to connect via ssh and all that, but for some reason it just stopped working after a fresh rebuild/reinstall of my filesystem. So I will try and report back.

Just wanted to say hey.
Cheers.

@vshymanskyy

So I was able to get everything back up and running following your post but now it seems like I am having issues with onoff when installing and running the blynk-client

pi@raspberrypi:~ $ sudo npm install -g onoff

> epoll@0.1.20 install /usr/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 "/usr/lib/node_modules/onoff/node_modules/epoll/.node-gyp"
make: Entering directory '/usr/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 '/usr/lib/node_modules/onoff/node_modules/epoll/build'
/usr/lib
└─┬ onoff@1.1.1 
  └─┬ epoll@0.1.20 
    ├── bindings@1.2.1 
    └── nan@2.4.0 

And I tried to remediate it by the following command:

pi@raspberrypi:~ $ sudo npm install -g --unsafe-perm onoff
/usr/lib
└── onoff@1.1.1 

And when I am running the blynk-client.js I get:

pi@raspberrypi:~ $ blynk-client <AUTH_TOKEN>
Connecting to: blynk-cloud.com 8441
SSL authorization...
Connected
Authorized
Blynk ready.
No direct pin operations available.
Maybe you need to install mraa or onoff modules?

I just finished a >whole runaround< of the same thing… apparently before any instruction updates were availed, but basicly exact same issues you are having now.

I ended up going the wiringPi way of installing Blynk (no NODE or ONOFF necessary). I have asked, but not yet received any feedback if this is a good, bad or ugly option… but it was a quick install and works.

So far I am just messing with direct pin access and have not yet made and scripts/executables… but it has been my best way to enjoy Blynk on the Pi so far :slight_smile:

Here is the link that shows the steps.

And the link for the home of >wiringPi< for reference.

1 Like

That’s funny because Earlier this afternoon I just read the topic you started, and I was going to fill you in if/when I was able to get anywhere with this. I’ll keep you up to date.

@Gunner

I just installed the repositories and wiringpi libraries, but still no luck while trying to run the blynk-client simple setup. Is there anything that I am missing, or are you still having issues as well?

Has anyone successfully installed node and npm recently on a Raspberry Pi 3 Model B and have it running with Blynk?

I don’t have any 3’s here.

@Costas I am actually using an older RPi model B rev 2.0 w/512MB

I not sure what you mean exactly by “simple setup”… are you referring to a specific command or just generalising?

Can you provide more details on the steps you have taken as well as the errors, if any, you encountered?

As for me, no problems anymore:

I just followed the directions for Blynk on wiringPi and it installed smoothly…

I did keep forgetting to change directories into /blynk-library/linux before running the command to connect to my Local Server sudo /blynk-library/linux/blynk --server=10.10.3.13 --port=8442 --token=00027da453xxxxxxxxxxx252c2d29 As well as closing the terminal window (which apparently shuts down the client… doh!) :blush:

I finally learned how to start the client and exit the window (with it running) as well as automatically by adding my startup command into rc.local, so now client is running all the time after reboot. :smile:

Again, all I am doing with it so far is directly controlling the GPx pins via Blynk app… making more powerful scripts with virtual pins will come later.

I am using a B rev 3.0 w/512MB and Zero.

@BigP0P5 is trying to get the node.js client running.

Maybe it doesn’t work on a 3?

Yeah, by simple script I am just generalizing.

I was just talking about the “simple” script that was contained on here in the DOCS section:

blynk-client <AUTH_TOKEN>

I went through the setup for WiringPi and everything seemed to go through without any errors, but still my scripts do not run :sweat:

Do I run blynk-client any different now that I have WiringPi installed?

I am not running a server yet, I just wanted to keep things simple at first and make sure everything will run on the command line, then on startup through a cronjob, then work on getting the server up and running.

I am starting to think I have a micro_controller curse, and I might just have to go back to using PLC’s and ladder logic.

I really don’t remember how the NODE method worked, as I was never able to get it running properly. But with the wiringPi method, first make sure you are in the correct directory (or include it in the command - see how I have done both, for reference, in the picture below) and then run sudo ./blynk --token=<AuthToken> (don’t include the <>) when using cloud server. I am unsure if you need the ./ or just / before blynk… probably depends on the directory or path.

If you have your own Local Server then you need to add the IP and port.

This is what it should roughly look like on the terminal:

So do I skip installing these packages altogether, and just go through with the walk-through you provided?

sudo apt-get install -y build-essential nodejs
sudo npm install -g npm
sudo npm install -g onoff
sudo npm install -g blynk-library

Just rebuilt and got to this point:

All Done.

NOTE: To compile programs with wiringPi, you need to add:
    -lwiringPi
  to your compile line(s) To use the Gertboard, MaxDetect, etc.
  code (the devLib), you need to also add:
    -lwiringPiDev
  to your compile line(s).

do I need to add any of these?

Yes, those are only for the NODE method… which for all I know, could probably be run simultaneously (assuming someone figures out the ONOFF issue).

I haven’t progressed that far myself… but yes they are added to the “custom script” portion (i.e. making your own code, using virtual pins, etc).

They do not get directly added to the terminal window… I believe you can think of them as including libraries.

Then I got here…with some problems

pi@raspberrypi:~/blynk-library/linux $ make clean all target=raspberry
rm main.o BlynkDebug.o ../src/utility/BlynkHandlers.o blynk
rm: cannot remove ‘main.o’: No such file or directory
rm: cannot remove ‘BlynkDebug.o’: No such file or directory
rm: cannot remove ‘../src/utility/BlynkHandlers.o’: No such file or directory
rm: cannot remove ‘blynk’: No such file or directory
Makefile:63: recipe for target 'clean' failed
make: [clean] Error 1 (ignored)
g++ -I ../src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY main.cpp -o main.o
g++ -I ../src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY BlynkDebug.cpp -o BlynkDebug.o
g++ -I ../src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY ../src/utility/BlynkHandlers.cpp -o ../src/utility/BlynkHandlers.o
g++ main.o BlynkDebug.o ../src/utility/BlynkHandlers.o -lrt -lpthread -s -lwiringPi -o blynk

Try this (warning, this has all been quickly cut and pasted… I have installed this before, but I might have made a typo here):

Start with running these commands, one after another, in a terminal window of your RPi - if one fails, then precede it with sudo

sudo apt-get update
sudo apt-get install git-core
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

To make sure the library has been installed, run the gpio -v command, which should return the version information.

----------------- for visual example -----------------

pi@raspberrypi:/blynk-library/linux $ gpio -v
gpio version: 2.25
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
  Type: Model B, Revision: 2, Memory: 512MB, Maker: Egoman

----------------- end visual example -----------------

To compile the Blynk library, use the following commands:

git clone https://github.com/blynkkk/blynk-library.git
cd blynk-library/linux
make clean all target=raspberry

Then In a Terminal window on your Raspberry Pi, switch to the blynk-library/linux directory

cd/ blynk-library/linux

and start the server using the command below (replace AuthToken with the actual token generated by the Blynk app):

sudo ./blynk --token=AuthToken

That command connects to Blynk’s default Cloud Server, so if you are running your own Local Server, you need to specify its address and port manually; for example:

sudo ./blynk --server=192.168.1.101 --port=8555 --token=AuthToken

If the connection has been established successfully, you should see the Blynk logo (in ASCII) and Ready! message.

1 Like

Looks more like there was nothing to clean up, not an actual error per se. Try the next steps in the quick-n-dirty guide I just previously posted.

make target=raspberry (clean all is removal for failed Make)