trying to install node-red-contrib-dht-sensor

2,061 views
Skip to first unread message

Michel Jutras

unread,
Feb 27, 2017, 10:19:42 PM2/27/17
to Node-RED
I have a fresh install of node-red on Jessie Lite, couldn't find the 'Manage Palette' option so I installed npm.
I then installed node-red-contrib-bmp085 and node-red-contrib-dashboard. All is working fine but when I tried to install  node-red-contrib-dht-sensor I get the following error in the debug section:

Error: Command failed: In file included from ../node-dht-sensor.cpp:2:0: ../node_modules/nan/nan.h:324:47: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’ static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8; ^ make: *** [Release/obj.target/node_dht_sensor/node-dht-sensor.o] Error 1 gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12) gyp ERR! System Linux 4.4.38-v7+ gyp ERR! command "nodejs" "/usr/bin/node-gyp" "build" gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-dht-sensor/node_modules/node-dht-sensor gyp ERR! node -v v0.10.29 gyp ERR! node-gyp -v v0.12.2 gyp ERR! not ok npm WARN This failure might be due to the use of legacy binary "n ....


npm -v is 1.4.21
at nodered -v I get command not found.

Mark Setrem

unread,
Feb 28, 2017, 6:16:56 AM2/28/17
to Node-RED
You need to upgrade npm to v2

sudo npm install -g npm@2.x
hash -r
cd ~/.node-red

Take a look at http://nodered.org/docs/hardware/raspberrypi which will also explain which nodes versions are recommended and a script that might help you.

Dave C-J

unread,
Feb 28, 2017, 11:22:10 AM2/28/17
to node...@googlegroups.com
And for that particular sensor... you may need to check the pre-reqs  http://flows.nodered.org/node/node-red-contrib-dht-sensor
and indeed it may need to run the whole thing as root... 
(basically it's a real pain)

Zenofmud

unread,
Feb 28, 2017, 5:09:18 PM2/28/17
to node...@googlegroups.com
I’m running node-red-contrib-dht-sensor and will be glad to help you. I just need to go back thru my notes. It might take a day or two - we're waiting for the imminent arrival of a granddaughter (if she doesn’t come tonight she is getting evicted tomorrow) and we will have a couple grandsons (4 1/2 and 2 1/2) to take care of for a day or two. But hopefully I have tomorrow morning!

Meanwhile this might(?) help. It was an issue I ran into awhile back with this and is from teh GITHUB Issues:


...I’ve just restarted from scratch (reformatted the sd card) and I see that in order to install node-red-contrib-dht-sensor I have to install node-dht-sensor and in order to install that, I need to install the BCM2835 library.

The BCM2835 library install runs fine but when I do 'npm install node-dht-sensor' I get

npm WARN engine node-dh...@0.0.8: wanted: {"node":">=0.12 <0.13"} (current: {"node":"0.10.36","npm":"1.4.28”})

so I upgraded npn to version 2.11.1 which allows 'node-dht-sensor’ to install but then 'node-red-contrib-dht-sensor’ fails.


Solution

So using npm v 1.4.28, I decided to install an old copy of 'node-dht-sensor' and version 0.0.8 -> 0.0.7 fail, but version 0.0.6 works and allows 'node-red-contrib-dht-sensor’ to install also.

I did have to use ‘sudo' and the ‘-g’ option to get them to show up, but that’s another issue.


I plan on redoing my install from scratch for a pi3 to see what is needed.

FYI: I’m running it on a RaspberryPi Model B (2011)
npm v2.15.11
node v4.6.2
node-red v0.16.0 
and I run node-red via the node-red-start command

Zenofmud

unread,
Mar 1, 2017, 10:28:22 AM3/1/17
to node...@googlegroups.com
I just went back and ran a fresh install using the 2017-02-16-raspbian-jessie-lite.img on a pi3
1) update everything:
sudo apt-get update && sudo apt-get upgrade -y
2) install node, npm and node red using the install script:
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
3) once that finished I verified the versions:
pi@testpi:~ $ npm -v
3.10.10
pi@testpi:~ $ node -v
v6.10.0
pi@testpi:~ $ node-red
1 Mar 09:29:29 - [info]

Welcome to Node-RED
===================

1 Mar 09:29:29 - [info] Node-RED version: v0.16.2
1 Mar 09:29:29 - [info] Node.js version: v6.10.0
1 Mar 09:29:29 - [info] Linux 4.4.48-v7+ arm LE

4) stopped node-red and installed bcm2835 with the following:
cd $home
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.52.tar.gz
tar zxvf bcm2835-1.52.tar.gz
cd bcm2835-1.52
./configure
make
sudo make check
sudo make install

5) install the items needed
sudo npm install -g node-dht-sensor
sudo npm install -g node-red-contrib-dht-sensor

And that point I run node-red (as just pi - not with sudo) and everything works.

-
> On Feb 28, 2017, at 5:07 PM, Zenofmud <zeno...@zenofmud.org> wrote:
>
> I’m running node-red-contrib-dht-sensor and will be glad to help you. I just need to go back thru my notes. It might take a day or two - we're waiting for the imminent arrival of a granddaughter (if she doesn’t come tonight she is getting evicted tomorrow) and we will have a couple grandsons (4 1/2 and 2 1/2) to take care of for a day or two. But hopefully I have tomorrow morning!
>
> Meanwhile this might(?) help. It was an issue I ran into awhile back with this and is from teh GITHUB Issues:
>
>
> ...I’ve just restarted from scratch (reformatted the sd card) and I see that in order to install node-red-contrib-dht-sensor I have to install node-dht-sensor and in order to install that, I need to install the BCM2835 library.
>
> The BCM2835 library install runs fine but when I do 'npm install node-dht-sensor' I get
>
> npm WARN engine node-dh...@0.0.8: wanted: {"node":">=0.12 <0.13"} (current: {"node":"0.10.36","npm":"1.4.28”})
>
> so I upgraded npn to version 2.11.1 which allows 'node-dht-sensor’ to install but then 'node-red-contrib-dht-sensor’ fails.
>
> Solution
>
> So using npm v 1.4.28, I decided to install an old copy of 'node-dht-sensor' and version 0.0.8 -> 0.0.7 fail, but version 0.0.6 works and allows 'node-red-contrib-dht-sensor’ to install also.
>
> I did have to use ‘sudo' and the ‘-g’ option to get them to show up, but that’s another issue.
>
>
> I plan on redoing my install from scratch for a pi3 to see what is needed.
>
> FYI: I’m running it on a RaspberryPi Model B (2011)
> npm v2.15.11
> node v4.6.2
> node-red v0.16.0
> and I run node-red via the node-red-start command
>
>
>> On Feb 27, 2017, at 10:19 PM, Michel Jutras <michel....@gmail.com> wrote:
>>
>> Error: Command failed: In file included from ../node-dht-sensor.cpp:2:0: ../node_modules/nan/nan.h:324:47: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’ static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8; ^ make: *** [Release/obj.target/node_dht_sensor/node-dht-sensor.o] Error 1 gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12) gyp ERR! System Linux 4.4.38-v7+ gyp ERR! command "nodejs" "/usr/bin/node-gyp" "build" gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-dht-sensor/node_modules/node-dht-sensor gyp ERR! node -v v0.10.29 gyp ERR! node-gyp -v v0.12.2 gyp ERR! not ok npm WARN This failure might be due to the use of legacy binary "n ....
>
>
> --
> http://nodered.org
>
> Join us on Slack to continue the conversation: http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
> To post to this group, send email to node...@googlegroups.com.
> Visit this group at https://groups.google.com/group/node-red.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/87DE4070-6094-4C65-BA5B-F6219EF0D45F%40zenofmud.org.
> For more options, visit https://groups.google.com/d/optout.

Michel Jutras

unread,
Mar 1, 2017, 2:18:31 PM3/1/17
to Node-RED
After updating to npm v2 I was able to install node-dht-sensor and node-red-contrib-dht-sensor but trying to run them was getting was getting TypeError: failed to initialize.

I will start fresh on a Pi2 following your procedure and give it a try.
Worse case, I have a Pi 3 on its way.

Thanks for this clear information.

Mark Setrem

unread,
Mar 1, 2017, 2:24:05 PM3/1/17
to Node-RED
You don't mention installing the BCM2835 library. Have you?

Mark Setrem

unread,
Mar 1, 2017, 2:24:06 PM3/1/17
to Node-RED

Zenofmud

unread,
Mar 1, 2017, 2:34:14 PM3/1/17
to node...@googlegroups.com
see step 4 in my message
> On Mar 1, 2017, at 2:24 PM, Mark Setrem <mse...@gmail.com> wrote:
>
> You don't mention installing the BCM2835 library. Have you?
>
> --
> http://nodered.org
>
> Join us on Slack to continue the conversation: http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
> To post to this group, send an email to node...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/ed63da3f-0156-43fb-a0f5-dd9fb48b3daf%40googlegroups.com.

Michel Jutras

unread,
Mar 1, 2017, 4:14:59 PM3/1/17
to Node-RED
It is working on Pi 2.
I was not able to install the dht-sensor but the contrib-dht-sensor is working.

I don't know if I should worry about this or it is a coincidence but when I first triggered a reading on the dht11 this messaged popped up on the putty terminal:
Message from syslogd@FLOjab at Mar  1 16:08:04 ...
 kernel
:[ 2859.956751] Disabling IRQ #79
Triggering other readings did not repeat the message.

Michel Jutras

unread,
Mar 1, 2017, 8:52:05 PM3/1/17
to Node-RED
Now node-red-contrib-bmp085 is no longer working. It was in my previous installation with npm v2.
I have i2c enabled and pi is a member of i2c

Is it possible that this node runs only on v2?

Zenofmud

unread,
Mar 1, 2017, 8:54:49 PM3/1/17
to node...@googlegroups.com
Did you run ‘sudo raspi-config’ and activating the I2C interface?
 
To post to this group, send email to node...@googlegroups.com.

Zenofmud

unread,
Mar 1, 2017, 8:56:54 PM3/1/17
to node...@googlegroups.com
Never mind - I should remember to read the whole message before responding. I’ll blame it on teh stress of gaining a new granddaughter today and now having her two brothers (2 1/2 and 4 1/2) over night

To post to this group, send email to node...@googlegroups.com.

Michel Jutras

unread,
Mar 1, 2017, 9:04:23 PM3/1/17
to Node-RED
I did, just to be sure I enabled again but when I try to install I get this:
gyp ERR! build error
gyp ERR
! stack Error: `make` failed with exit code: 2

gyp ERR
! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR
! stack     at emitTwo (events.js:106:13)
gyp ERR
! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR
! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR
! System Linux 4.4.48-v7+
gyp ERR
! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR
! cwd /home/pi/node_modules/i2c
gyp ERR
! node -v v6.10.0
gyp ERR
! node-gyp -v v3.4.0
gyp ERR
! not ok
npm WARN enoent ENOENT
: no such file or directory, open '/home/pi/package.json'
npm WARN pi
No description
npm WARN pi
No repository field.
npm WARN pi
No README data
npm WARN pi
No license field.
npm ERR
! Linux 4.4.48-v7+
npm ERR
! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "node-red-contrib-bmp085"
npm ERR
! node v6.10.0
npm ERR
! npm  v3.10.10
npm ERR
! code ELIFECYCLE

npm ERR
! i2c@0.1.8 install: `node-gyp rebuild`
npm ERR
! Exit status 1
npm ERR
!
npm ERR
! Failed at the i2c@0.1.8 install script 'node-gyp rebuild'.
npm ERR
! Make sure you have the latest version of node.js and npm installed.
npm ERR
! If you do, this is most likely a problem with the i2c package,
npm ERR
! not with npm itself.
npm ERR
! Tell the author that this fails on your system:
npm ERR
!     node-gyp rebuild
npm ERR
! You can get information on how to open an issue for this project with:
npm ERR
!     npm bugs i2c
npm ERR
! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls i2c
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/npm-debug.log

Michel Jutras

unread,
Mar 1, 2017, 9:07:39 PM3/1/17
to Node-RED
Hey congrats on the new member of your family. I got a new grand daughter last summer and it's a lot of fun.

Zenofmud

unread,
Mar 2, 2017, 5:57:46 AM3/2/17
to node...@googlegroups.com

Zenofmud

unread,
Mar 3, 2017, 8:20:12 AM3/3/17
to node...@googlegroups.com
Michel,

I just ran those same steps on a 
RaspberryPi 2 Model B released Q1 2015
Revision : ‘a21041'
and it works fine

Here is a dump of the object

3/1/2017, 2:58:15 PMnode: dd94b22f.6ec12rpi-dht22 : msg : Object
{ _msgid: "617950d5.adfae", topic: "rpi-dht22", payload: "22.70", humidity: "44.10", sensorid: "dht22"}.

Michel Jutras

unread,
Mar 4, 2017, 10:00:25 AM3/4/17
to Node-RED
I had some issues and decided to look at this from a different perspective.
Instead of installing Jessie lite and adding to it, I flushed everything and started fresh with the full Jessie and it all ended up working.

Of course I ran into more issues down the line but I started a new post because it is a different subject.
https://groups.google.com/forum/#!topic/node-red/-caJqTQu_4c

Justin Haury

unread,
Mar 8, 2017, 3:00:37 AM3/8/17
to Node-RED
You were finally able to get the bmp085 node to work in Jessie? I have been fighting with the bmp085 and dht11 nodes forever, and I mean forever. I can only ever seem to get one or the other to work. I have a RPI2 and a RPi B+, can''t get the bmp085 node to work for nothing. Throws that same i2c error every time. I was able to get the dht11 node to work on both. You say you finally got it working after installing Jessie full? I started with Jessie full, where did I go wrong?

Jessie full
Node 4.7.3
npm 2.15.11


gyp ERR! build error 

gyp ERR! stack Error: `make` failed with exit code: 2

gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)

gyp ERR! stack     at emitTwo (events.js:87:13)

gyp ERR! stack     at ChildProcess.emit (events.js:172:7)

gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:12)

gyp ERR! System Linux 4.4.38-v7+

gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-bmp085/node_modules/bmp085/node_modules/i2c

gyp ERR! node -v v4.7.3

gyp ERR! node-gyp -v v3.4.0

gyp ERR! not ok 

npm ERR! Linux 4.4.38-v7+

npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "node-red-contrib-bmp085"

npm ERR! node v4.7.3

npm ERR! npm  v2.15.11

npm ERR! code ELIFECYCLE


npm ERR! i...@0.1.8 install: `node-gyp rebuild`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the i...@0.1.8 install script 'node-gyp rebuild'.

npm ERR! This is most likely a problem with the i2c package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR!     node-gyp rebuild

npm ERR! You can get information on how to open an issue for this project with:

npm ERR!     npm bugs i2c

npm ERR! Or if that isn't available, you can get their info via:

npm ERR! 

npm ERR!     npm owner ls i2c

npm ERR! There is likely additional logging output above.


npm ERR! Please include the following file with any support request:

npm ERR!     /home/pi/.node-red/npm-debug.log

Michel Jutras

unread,
Mar 8, 2017, 9:16:44 AM3/8/17
to Node-RED
Justin,

I share your pain, I struggled for a long time trying to get those two working at the same time. At one point I did a fresh install, update and upgrade everything and it worked but I have wiped out my installation to work on something else and when I tried again, I could not get both working anymore. So I gave up and purchased a BME280 for a few dollars, this module includes Humidity, Temperature and atmospheric pressure and is available as node-red-contrib-bme280-rpi and I was able to install. I have not received the sensor yet but my fingers are crossed. Sorry if I am not much help, I am a PC tech trying to learn Linux.

Justin Haury

unread,
Mar 8, 2017, 1:01:32 PM3/8/17
to Node-RED
Michel,

Thanks for the quick reply, and it is funny that you say that. I am taking the same path. I found node-red-contrib-bme280-rpi a few days ago and it installed just fine on both Pies, so I ordered some bme280 modules off ebay. Just waiting for them to arrive also. It's a shame we cant get the bmp085 node to work.
Reply all
Reply to author
Forward
0 new messages