Node and NPM Issues

I am installing Blynk on my Raspberry Pi 3 Model B with the ARMv7 chipset.

I have had the blynk.js script work before but now I am having issues running this simple script.

I have re-installed Raspbian multiple times, but to no avail I cannot get it working again.

I am following the install guide for Raspberry Pi on the Blynk DOCS page, and it goes a little something like this:

1.) Add the Adafruit package repository. (Within this package installation it removes nodered)

curl -sLS https://apt.adafruit.com/add | sudo bash

2.) Install the “newest”(please note the quotes as I will mention below) version of nodejs.

sudo apt-get install node

3.) Update and Upgrade

sudo apt-get update && sudo apt-get upgrade

4.) Install build-essential

sudo apt-get install build-essential

5.) Install Node package manager

sudo npm install -g npm

6.) Install onoff package (This is where I run into issues)

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/

> epoll@0.1.20 install /usr/local/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/0.12.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp"
make: Entering directory '/usr/local/lib/node_modules/onoff/node_modules/epoll/build'
  CXX(target) Release/obj.target/epoll/src/epoll.o
In file included from /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/deps/v8/include/v8stdint.h:13:0,
                 from /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/deps/v8/include/v8.h:18,
                 from ../src/epoll.cc:11:
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h: In function ‘void node::FatalException(const v8::TryCatch&)’:
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:275:61: warning: ‘void node::FatalException(v8::Isolate*, const v8::TryCatch&)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:270): Use ParseEncoding(isolate, ...) [-Wdeprecated-declarations]
   return FatalException(v8::Isolate::GetCurrent(), try_catch);
                                                             ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/deps/v8/include/v8config.h:313:1: note: in definition of macro ‘V8_DEPRECATED’
 declarator __attribute__((deprecated(message)))
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:273:1: note: in expansion of macro ‘NODE_DEPRECATED’
 NODE_DEPRECATED("Use FatalException(isolate, ...)",
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h: In function ‘v8::Local<v8::Value> node::Encode(const void*, size_t, node::encoding)’:
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:287:62: warning: ‘v8::Local<v8::Value> node::Encode(v8::Isolate*, const void*, size_t, node::encoding)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:278): Use FatalException(isolate, ...) [-Wdeprecated-declarations]
   return Encode(v8::Isolate::GetCurrent(), buf, len, encoding);
                                                              ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/deps/v8/include/v8config.h:313:1: note: in definition of macro ‘V8_DEPRECATED’
 declarator __attribute__((deprecated(message)))
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:282:1: note: in expansion of macro ‘NODE_DEPRECATED’
 NODE_DEPRECATED("Use Encode(isolate, ...)",
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h: In function ‘ssize_t node::DecodeBytes(v8::Handle<v8::Value>, node::encoding)’:
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:298:62: warning: ‘ssize_t node::DecodeBytes(v8::Isolate*, v8::Handle<v8::Value>, node::encoding)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:291): Use Encode(isolate, ...) [-Wdeprecated-declarations]
   return DecodeBytes(v8::Isolate::GetCurrent(), val, encoding);
                                                              ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/deps/v8/include/v8config.h:313:1: note: in definition of macro ‘V8_DEPRECATED’
 declarator __attribute__((deprecated(message)))
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:294:1: note: in expansion of macro ‘NODE_DEPRECATED’
 NODE_DEPRECATED("Use DecodeBytes(isolate, ...)",
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h: In function ‘ssize_t node::DecodeWrite(char*, size_t, v8::Handle<v8::Value>, node::encoding)’:
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:312:75: warning: ‘ssize_t node::DecodeWrite(v8::Isolate*, char*, size_t, v8::Handle<v8::Value>, node::encoding)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:302): Use DecodeBytes(isolate, ...) [-Wdeprecated-declarations]
   return DecodeWrite(v8::Isolate::GetCurrent(), buf, buflen, val, encoding);
                                                                           ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/deps/v8/include/v8config.h:313:1: note: in definition of macro ‘V8_DEPRECATED’
 declarator __attribute__((deprecated(message)))
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:307:1: note: in expansion of macro ‘NODE_DEPRECATED’
 NODE_DEPRECATED("Use DecodeWrite(isolate, ...)",
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h: In function ‘v8::Local<v8::Object> node::Buffer::New(v8::Handle<v8::String>, node::encoding)’:
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:58:52: warning: ‘v8::Local<v8::Object> node::Buffer::New(v8::Isolate*, v8::Handle<v8::String>, node::encoding)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:52): Use New(isolate, ...) [-Wdeprecated-declarations]
   return New(v8::Isolate::GetCurrent(), string, enc);
                                                    ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/deps/v8/include/v8config.h:313:1: note: in definition of macro ‘V8_DEPRECATED’
 declarator __attribute__((deprecated(message)))
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:55:1: note: in expansion of macro ‘NODE_DEPRECATED’
 NODE_DEPRECATED("Use New(isolate, ...)",
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h: In function ‘v8::Local<v8::Object> node::Buffer::New(const char*, size_t)’:
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:67:50: warning: ‘v8::Local<v8::Object> node::Buffer::New(v8::Isolate*, const char*, size_t)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:62): Use New(isolate, ...) [-Wdeprecated-declarations]
   return New(v8::Isolate::GetCurrent(), data, len);
                                                  ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/deps/v8/include/v8config.h:313:1: note: in definition of macro ‘V8_DEPRECATED’
 declarator __attribute__((deprecated(message)))
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:65:1: note: in expansion of macro ‘NODE_DEPRECATED’
 NODE_DEPRECATED("Use New(isolate, ...)",
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h: In function ‘v8::Local<v8::Object> node::Buffer::New(char*, size_t, node::smalloc::FreeCallback, void*)’:
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:80:69: warning: ‘v8::Local<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t, node::smalloc::FreeCallback, void*)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:70): Use New(isolate, ...) [-Wdeprecated-declarations]
   return New(v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                                     ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/deps/v8/include/v8config.h:313:1: note: in definition of macro ‘V8_DEPRECATED’
 declarator __attribute__((deprecated(message)))
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:75:1: note: in expansion of macro ‘NODE_DEPRECATED’
 NODE_DEPRECATED("Use New(isolate, ...)",
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h: In function ‘v8::Local<v8::Object> node::Buffer::Use(char*, uint32_t)’:
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:90:50: warning: ‘v8::Local<v8::Object> node::Buffer::Use(v8::Isolate*, char*, uint32_t)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:85): Use New(isolate, ...) [-Wdeprecated-declarations]
   return Use(v8::Isolate::GetCurrent(), data, len);
                                                  ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/deps/v8/include/v8config.h:313:1: note: in definition of macro ‘V8_DEPRECATED’
 declarator __attribute__((deprecated(message)))
 ^
/usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:88:1: note: in expansion of macro ‘NODE_DEPRECATED’
 NODE_DEPRECATED("Use Use(isolate, ...)",
 ^
In file included from ../src/epoll.cc:15:0:
../../nan/nan.h: In function ‘Nan::MaybeLocal<v8::Object> Nan::NewBuffer(char*, size_t, node::smalloc::FreeCallback, void*)’:
../../nan/nan.h:685:64: warning: ‘v8::Local<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t, node::smalloc::FreeCallback, void*)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:70): Use New(isolate, ...) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), data, length, callback, hint));
                                                                ^
../../nan/nan.h: In function ‘Nan::MaybeLocal<v8::Object> Nan::CopyBuffer(const char*, uint32_t)’:
../../nan/nan.h:701:46: warning: ‘v8::Local<v8::Object> node::Buffer::New(v8::Isolate*, const char*, size_t)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:62): Use New(isolate, ...) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), data, size));
                                              ^
../../nan/nan.h: In function ‘Nan::MaybeLocal<v8::Object> Nan::NewBuffer(char*, uint32_t)’:
../../nan/nan.h:729:64: warning: ‘v8::Local<v8::Object> node::Buffer::Use(v8::Isolate*, char*, uint32_t)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node_buffer.h:85): Use New(isolate, ...) [-Wdeprecated-declarations]
         node::Buffer::Use(v8::Isolate::GetCurrent(), data, size));
                                                                ^
../../nan/nan.h: In function ‘void Nan::FatalException(const Nan::TryCatch&)’:
../../nan/nan.h:850:73: warning: ‘void node::FatalException(v8::Isolate*, const v8::TryCatch&)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:270): Use ParseEncoding(isolate, ...) [-Wdeprecated-declarations]
     node::FatalException(v8::Isolate::GetCurrent(), try_catch.try_catch_);
                                                                         ^
../../nan/nan.h: In function ‘v8::Local<v8::Value> Nan::Encode(const void*, size_t, Nan::Encoding)’:
../../nan/nan.h:1760:44: warning: ‘v8::Local<v8::Value> node::Encode(v8::Isolate*, const void*, size_t, node::encoding)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:278): Use FatalException(isolate, ...) [-Wdeprecated-declarations]
     , static_cast<node::encoding>(encoding));
                                            ^
../../nan/nan.h: In function ‘ssize_t Nan::DecodeBytes(v8::Local<v8::Value>, Nan::Encoding)’:
../../nan/nan.h:1776:44: warning: ‘ssize_t node::DecodeBytes(v8::Isolate*, v8::Handle<v8::Value>, node::encoding)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:291): Use Encode(isolate, ...) [-Wdeprecated-declarations]
     , static_cast<node::encoding>(encoding));
                                            ^
../../nan/nan.h: In function ‘ssize_t Nan::DecodeWrite(char*, size_t, v8::Local<v8::Value>, Nan::Encoding)’:
../../nan/nan.h:1798:44: warning: ‘ssize_t node::DecodeWrite(v8::Isolate*, char*, size_t, v8::Handle<v8::Value>, node::encoding)’ is deprecated (declared at /usr/local/lib/node_modules/onoff/node_modules/epoll/.node-gyp/0.12.6/src/node.h:302): Use DecodeBytes(isolate, ...) [-Wdeprecated-declarations]
     , static_cast<node::encoding>(encoding));
                                            ^
  SOLINK_MODULE(target) Release/obj.target/epoll.node
  COPY Release/epoll.node
make: Leaving directory '/usr/local/lib/node_modules/onoff/node_modules/epoll/build'
/usr/local/lib
└─┬ onoff@1.1.1 
  └─┬ epoll@0.1.20 
    ├── bindings@1.2.1 
    └── nan@2.4.0

Issues to address:

  • What are the differences between node and nodejs?

  • The node version I have installed v0.12.6

  • The nodejs version I have installed is v0.10.29

  • The npm version I have installed is 4.1.2

I have tried alternative methods before to installing the latest version of nodejs (http://thisdavej.com/beginners-guide-to-installing-node-js-on-a-raspberry-pi/) I believe to be 7.4.0 by using another package repository, but run into similar issues.

I am fairly new to Raspberry Pi and Raspbian, but have been using *nix type systems on and off for around 10 years. I am a junior in an Electrical Engineering BTech ABET program, which does not have a lot of programming requirements as far as Java and such. But I have used C and MATLAB and understand the basic concepts of programming.

So any help would be appreciated, as Costas has helped me tremendously before, I was to the point where I was having issues running scripts at startup, but it now seems like I have taken 2 steps back.

Thanks.

OK, remove node and nodejs completely.
Follow this guide: https://www.hackster.io/vshymanskyy/blynk-javascript-in-20-minutes-3ee903

I am actually following the samething in instructables.

No, it was outdated a bit. I just updated Instructables and docs, should appear soon!
Hackster has already updated version.

Thanks!

But that is not ARM node uh? I got CB’ed by the board.

@aid_blue there actually was also a small mistake on hackster, which is fixed - so just refresh the page.
Raspi is ARM…

Nope.

https://github.com/nodesource/distributions I think we are in the wrong place man!

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?