# Node-red-contrib-dht-sensor

**URL:** <https://discourse.nodered.org/t/node-red-contrib-dht-sensor/69376>\
**Category:** General\
**Created:** [21 October 2022 12:08 UTC](https://discourse.nodered.org/t/node-red-contrib-dht-sensor/69376 "2022-10-21T12:08:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alsama7ii](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Alsama7ii](https://discourse.nodered.org/u/Alsama7ii)\
**Post date:** [21 October 2022 12:08 UTC](https://discourse.nodered.org/t/node-red-contrib-dht-sensor/69376/1 "2022-10-21T12:08:10Z")

</div>

I am trying to install node-red-contrib-dht-sensor. I have followed the three steps which are:

Step 1- Installing BCM2835 library

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/d/7d2dfecb097fd25d35766e864b0a656e132b4b3b.png)

Step 2 & 3 - Install the node-dht-sensor dependency

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/e/2e5d092ceaf0d9da34cdec80cd4d61fd64f81ae1.png)

nodejs version: v12.22.12  
npm version: 8.19.2

However, it is not installed. Here is the error message that I get:

* * *

2022-10-21T12:02:01.048Z Install : node-red-contrib-dht-sensor 1.0.4

2022-10-21T12:02:01.217Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-dht-sensor@1.0.4  
2022-10-21T12:02:14.116Z [err] npm ERR! code 1  
2022-10-21T12:02:14.116Z [err] npm ERR! path /home/pi/.node-red/node\_modules/node-dht-sensor  
2022-10-21T12:02:14.129Z [err] npm  
2022-10-21T12:02:14.130Z [err] ERR! command failed  
2022-10-21T12:02:14.130Z [err] npm ERR! command sh -c node-gyp configure  
2022-10-21T12:02:14.130Z [err] npm  
2022-10-21T12:02:14.130Z [err] ERR! gyp info it worked if it ends with ok  
2022-10-21T12:02:14.130Z [err] npm  
2022-10-21T12:02:14.130Z [err] ERR! gyp info using node-gyp@3.8.0  
2022-10-21T12:02:14.131Z [err] npm ERR!  
2022-10-21T12:02:14.131Z [err] gyp info using node@12.22.12 | linux | arm  
2022-10-21T12:02:14.131Z [err] npm  
2022-10-21T12:02:14.131Z [err] ERR! gyp ERR! configure error  
2022-10-21T12:02:14.131Z [err] npm  
2022-10-21T12:02:14.131Z [err] ERR! gyp ERR! stack Error: Command failed: /usr/bin/python -c import sys; print "%s.%s.%s" % sys.version\_info[:3];  
2022-10-21T12:02:14.131Z [err] npm ERR!  
2022-10-21T12:02:14.131Z [err] gyp ERR! stack File "", line 1  
2022-10-21T12:02:14.131Z [err] npm  
2022-10-21T12:02:14.131Z [err] ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version\_info[:3];  
2022-10-21T12:02:14.131Z [err] npm ERR!  
2022-10-21T12:02:14.132Z [err] gyp ERR! stack ^  
2022-10-21T12:02:14.132Z [err] npm ERR!  
2022-10-21T12:02:14.132Z [err] gyp ERR! stack SyntaxError: invalid syntax  
2022-10-21T12:02:14.132Z [err] npm  
2022-10-21T12:02:14.132Z [err] ERR! gyp ERR! stack  
2022-10-21T12:02:14.132Z [err] npm  
2022-10-21T12:02:14.132Z [err] ERR!  
2022-10-21T12:02:14.132Z [err] gyp ERR! stack at ChildProcess.exithandler (child\_process.js:308:12)  
2022-10-21T12:02:14.132Z [err] npm ERR!  
2022-10-21T12:02:14.132Z [err] gyp ERR! stack at ChildProcess.emit (events.js:314:20)  
2022-10-21T12:02:14.132Z [err] npm  
2022-10-21T12:02:14.132Z [err] ERR! gyp ERR! stack at maybeClose (internal/child\_process.js:1022:16)  
2022-10-21T12:02:14.132Z [err] npm  
2022-10-21T12:02:14.133Z [err] ERR!  
2022-10-21T12:02:14.133Z [err] gyp ERR! stack at Process.ChildProcess.\_handle.onexit (internal/child\_process.js:287:5)  
2022-10-21T12:02:14.133Z [err] npm ERR!  
2022-10-21T12:02:14.133Z [err] gyp ERR! System Linux 5.15.61-v7+  
2022-10-21T12:02:14.133Z [err] npm  
2022-10-21T12:02:14.133Z [err] ERR! gyp ERR! command "/usr/bin/node" "/home/pi/.node-red/node\_modules/.bin/node-gyp" "configure"  
2022-10-21T12:02:14.133Z [err] npm  
2022-10-21T12:02:14.133Z [err] ERR! gyp ERR! cwd /home/pi/.node-red/node\_modules/node-dht-sensor  
2022-10-21T12:02:14.133Z [err] npm ERR!  
2022-10-21T12:02:14.133Z [err] gyp ERR! node -v v12.22.12  
2022-10-21T12:02:14.133Z [err] npm ERR!  
2022-10-21T12:02:14.134Z [err] gyp ERR! node-gyp -v v3.8.0  
2022-10-21T12:02:14.134Z [err] npm  
2022-10-21T12:02:14.134Z [err] ERR! gyp ERR! not ok  
2022-10-21T12:02:14.206Z [err]  
2022-10-21T12:02:14.206Z [err] npm ERR!  
2022-10-21T12:02:14.206Z [err] A complete log of this run can be found in:  
2022-10-21T12:02:14.206Z [err] npm ERR! /home/pi/.npm/\_logs/2022-10-21T12\_02\_14\_140Z-debug.log  
2022-10-21T12:02:14.232Z rc=1

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [21 October 2022 12:45 UTC](https://discourse.nodered.org/t/node-red-contrib-dht-sensor/69376/2 "2022-10-21T12:45:03Z")

</div>

Hi @Alsama7ii

Did you do all of the necessary steps to install the library?

```auto
tar zxvf bcm2835-1.xx.tar.gz
cd bcm2835-1.xx
./configure
make
sudo make check
sudo make install

```

Usually you do not have to use sudo to install a node, and you should be in /home/pi/.node-red when you install.  
However, these days it is easier to install a node via"Manage Palette" in the editor

 ![Untitled 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/780d8057b0b4b49c4922c9285d5b0be9d9c14464.jpeg)  
 ![Untitled 3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/b/7b1dff35635734bf75c9eaef1d3ab062317df684.jpeg)

---

<div class="post-metadata">

**Author:** ![Alsama7ii](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Alsama7ii](https://discourse.nodered.org/u/Alsama7ii)\
**Post date:** [21 October 2022 13:33 UTC](https://discourse.nodered.org/t/node-red-contrib-dht-sensor/69376/3 "2022-10-21T13:33:18Z")

</div>

> [@jbudd](#):
>
> do all of the necessary steps to install the library

Yes, I did all of the necessary steps to install the library. And I have tried to delete node-dht-sensor dependency and the install via "Manage Palette". Still the same error.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 October 2022 15:42 UTC](https://discourse.nodered.org/t/node-red-contrib-dht-sensor/69376/4 "2022-10-21T15:42:10Z")

</div>

> [@jbudd](#):
>
> Usually you do not have to use sudo to install a node,

... however if you read the readme for this node - then in this case you do... (and you need to run Node-RED as root...) which is also not recommended... Also node v12 is no longer supported...

All in all I really wouldn't use this node... And those DHT sensors are well known to be inaccurate - so again good to avoid if at all possible.

but yes - you need to need t be in the ~/.node-red directory when you install nodes manually.

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [21 October 2022 16:26 UTC](https://discourse.nodered.org/t/node-red-contrib-dht-sensor/69376/5 "2022-10-21T16:26:17Z")

</div>

> [@dceejay](#):
>
> And those DHT sensors are well known to be inaccurate

Indeed inaccurate for measuring relative humidity but for temperature they are pretty OK.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 October 2022 16:27 UTC](https://discourse.nodered.org/t/node-red-contrib-dht-sensor/69376/6 "2022-10-21T16:27:13Z")

</div>

I find they are usually 3-4 degC off - but yes you can compensate.

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [21 October 2022 16:38 UTC](https://discourse.nodered.org/t/node-red-contrib-dht-sensor/69376/7 "2022-10-21T16:38:08Z")

</div>

> [@dceejay](#):
>
> I find they are usually 3-4 degC off

Maybe that is the case for the `dht11`, but for the `dht22` I have never seen that issue.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 December 2022 16:38 UTC](https://discourse.nodered.org/t/node-red-contrib-dht-sensor/69376/8 "2022-12-20T16:38:39Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
