- Go to https://nodejs.org and look for the current version of node.js. At this moment, for me version
9.5.0
is the current version. - Open Terminal and Type
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
- Note: in future if you see the current version 10.x.x then in the URL above replace setup_9.x with
setup_10.x
sudo apt-get install nodejs
sudo apt-get install npm
sudo npm i -g npm
- In order for some npm packages to work (such as those that require building from source), you will need to install the build-essentials package.
sudo apt-get install build-essential
- Go to : http://www.airspayce.com/mikem/bcm2835 and check for the latest version of the library. For me it is
bcm2835-1.55
now. - Open Terminal and type:
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.55.tar.gz
tar zxvf bcm2835-1.55.tar.gz
: This will unzip this file.cd bcm2835-1.55
: Go to this directory./configure
make
sudo make check
sudo make install
- To install git on your Raspberry Pi, open terminal and Type:
sudo apt-get install git-core
git clone https://github.com/apal21/Raspberry-Pi-DHT11-Node.js
cd Raspberry-Pi-DHT11-Node.js
npm install
node index.js
ornpm run test
mkdir DHT11 && cd DHT11
npm init --yes
nano index.js
and paste the content of this repo's index.js file.npm install node-dht-sensor
node index.js