Raspverry Pi にNode-RED をインストールする



  • Raspberry Pi 1 MODEL B+
  • Raspberry Pi 3
  • Raspberry Pi Zero W

  • インストールイメージ:2017-11-29-raspbian-stretch-lite.img

初期設定は Raspberry Pi 初期設定 - Qiita を参照


$ sudo apt-get install nodered
$ update-nodejs-and-nodered 

This script will remove versions of Node.js prior to version 6.x of Node.js and Node-RED
and if necessary replace them with Node.js 8.x LTS (carbon) and the latest Node-RED from Npm.

It also moves any Node-RED nodes that are globally installed into your user
~/.node-red/node_modules directory, and adds them to your package.json, so that
you can manage them with the palette manager.

It also tries to run 'npm rebuild' to refresh any extra nodes you have installed
that may have a native binary component. While this normally works ok, you need
to check that it succeeds for your combination of installed nodes.

To do all this it runs commands as root - please satisfy yourself that this will
not damage your Pi, or otherwise compromise your configuration.
If in doubt please backup your SD card first.

Are you really sure you want to do this ? [y/N] ? y

Running Node-RED update for user pi at /home/pi

This can take 20-30 minutes on the slower Pi versions - please wait.

  Stop Node-RED                       ✔
  Remove old version of Node-RED      ✔
  Remove old version of Node.js       ✔
  Install Node.js for Armv6           ✔   Node v8.9.4   Npm 5.6.0
  Clean npm cache                     ✔
  Install Node-RED core               ✔   0.18.2 
  Move global nodes to local          ✔
  Install extra Pi nodes              -
  Npm rebuild existing nodes          ✔
  Add menu shortcut                   ✔
  Update systemd script               ✔
  Update update script                ✔

Any errors will be logged to   /var/log/nodered-install.log

All done.
  You can now start Node-RED with the command  node-red-start
  or using the icon under   Menu / Programming / Node-RED
  Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started  2018年  2月 11日 日曜日 16:12:44 JST  -  Finished  2018年  2月 11日 日曜日 16:29:33 JST

2018/02/11 時点では NodeのバージョンはLTSである v8.9.4 になっている。

ちなみにupdate-nodejs-and-noderedコマンドは Node-REDのアップグレードに利用できる。
既存の Node.js と Node-REDをアンインストールしてから最新をインストールするが、



$ node-red-start

実行後、http://raspberrypi.local:1880/ にアクセス。
ホスト名を変更していたら、 http://<変更後のホスト名>.local:1880/ にアクセスする。




$ sudo systemctl enable nodered.service



Node-RED : Running on Raspberry Pi