19
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Last updated at Posted at 2017-12-03

環境

次のモデルで確認済

  • Raspberry Pi 1 MODEL B+

  • Raspberry Pi 3

  • Raspberry Pi Zero W

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

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

Node-REDのインストール

$ 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の設定(追加インストールしたノード、登録したフロー)が消えることはない。

起動確認

node-red-startコマンドで起動する。

$ node-red-start

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

Node-REDのエディタが開けば起動成功

自動起動設定

次のコマンドを実行する。

$ sudo systemctl enable nodered.service

再起動して、起動しているのを確認する。

参考

Node-RED : Running on Raspberry Pi

19
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?