How to install Node-RED in Raspberry pi
Step 1: Setup
How to set up the Raspberry Pi?
If you download and install 'Raspbian Stretch with desktop and recommended software' on your Pi, Node-RED is already installed.
You can see how to start it at the end of the tutorial.
Add TipAsk QuestionCommentDownload
Step 2: Check for Updates
Type in this command to check for updates:
sudo apt-get update
Add TipAsk QuestionCommentDownload
Step 3: Download and Install NodeJS
First you have to find out which version of NodeJS you need. Type in this command to find out:
uname -m
If the response starts with armv6, then you will need the ARMv6 version. Otherwise, if it starts with armv7, you will need the ARMv7 version.
- Copy the link of the version you need from the NodeJS website
- Paste it after you type 'wget' in the console of your Pi
wget [YOUR_NODEJS_DOWNLOAD_LINK]
eg. wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-armv7l.tar.xz- Press enter. NodeJS will now download
- After the download finished, extract the file
tar xf [YOUR_DOWNLOADED_NODEJS_FILE]
e.g. tar xf node-v10.16.0-linux-armv7l.tar.xz - Navigate into the extracted directory
cd [YOUR_EXTRACTED_DIRECTORY]
e.g. cd node-v10.16.0-linux-armv7l - Copy all files to '/usr/local/'
sudo cp -R * /usr/local
Check if everything has installed successfully:
node -v
npm -v
Those commands should now return the version of node and npm. If they don't do that, you have probably downloaded the wrong NodeJS version.
Step 4: Install and Start Node-RED
Install Node-RED via the Node Package Manager:
sudo npm install -g --unsafe-perm node-red
After Node-RED has installed, you can start it with this command:
node-red
The response should be something like this:
Welcome to Node-RED
===================25 Mar 22:51:09 - [info] Node-RED version: v0.20.5
25 Mar 22:51:09 - [info] Node.js version: v10.15.3
25 Mar 22:51:09 - [info] Loading palette nodes
25 Mar 22:51:10 - [warn] ------------------------------------------
25 Mar 22:51:10 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
25 Mar 22:51:10 - [warn] ------------------------------------------
25 Mar 22:51:10 - [info] Settings file : /home/nol/.node-red/settings.js
25 Mar 22:51:10 - [info] Context store : 'default' [module=localfilesystem]
25 Mar 22:51:10 - [info] User Directory : /home/nol/.node-red
25 Mar 22:51:10 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
25 Mar 22:51:10 - [info] Server now running at http://127.0.0.1:1880/
25 Mar 22:51:10 - [info] Creating new flows file : flows_noltop.json
25 Mar 22:51:10 - [info] Starting flows
25 Mar 22:51:10 - [info] Started flows
The address of the server will be displayed in the response. (it's bold in this sample response)
Node-RED is now available at: http://[IP_OF_YOUR_PI]:1880/
You have now successfully installed Node-RED on your Raspberry Pi!