Node-RED安裝

LHB阿好伯, 2021/03/13

tags: Node-RED

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Windows安裝

1. 安裝Node.js

https://nodered.org/docs/getting-started/windows

先從Node.js官方下載最新的12.x LTS版本

安裝後啟動Node.js command prompt輸入

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

node --version && npm --version

應該會收到類似下方的資訊

v12.15.0
6.14.5

2. 安裝Node-RED

npm install -g --unsafe-perm node-red

應該可以看到類似下面的畫面

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

3.執行

node-red

可以看到伺服器已經在電腦運作

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

開啟瀏覽器輸入http://127.0.0.1:1880/
就可以看到軟體的畫面了

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

設定開機自動執行

使用Win內建的工作排程器

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

建立一個基本工作
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

選擇開機時執行啟動程式

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

輸入

C:\Users\<user>\AppData\Roaming\npm\node-red.cmd

要將<user>改成自己電腦的實際使用者名稱

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Ubuntu安裝

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

啟動

node-red-pi --max-old-space-size=256

在瀏覽器輸入此網址即可開啟Node-Red

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Ubunte升級node-red 3.0

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Raspberry Pi安裝

https://nodered.org/docs/getting-started/raspberrypi
執行Node-RED提供的腳本

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

該腳本將:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

刪除Node-RED和Node.js的預設版本(如果存在)
使用NodeSource安裝當前的Node.js LTS版本
使用npm安裝最新版本的Node-RED
(可選)安裝有用的Pi特定節點的集合
設置Node-RED以作為服務運行,並提供一組與該服務一起使用的命令

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

執行Node-RED

由於Raspberry Pi的內存有限
可以使用附加參數啟動Node-RED

node-red-pi --max-old-space-size=256

作為伺服器運行

如果要在打開或重新啟動Pi時運行Node-RED執行下方指令

sudo systemctl enable nodered.service

連線

從另一台電腦瀏覽時
應使用Pi的IP地址
http://<hostname>:1880
您可以通過hostname -I在Pi上運行找到IP地址。

http://192.168.8.152:1880/

最後使用VNC Viewer 遠端連線到樹莓派就可以盡情享受Node-RED了
相比於電腦我也更傾向於使用樹莓派作為伺服器
一來省電二來樹莓派接個小螢幕還可以做為的儀表板使用

🌟全文可以至下方連結觀看或是補充
https://hackmd.io/@LHB-0222/Node-RED

全文分享至

https://www.facebook.com/LHB0222/

https://www.instagram.com/ahb0222/

有疑問想討論的都歡迎於下方留言

喜歡的幫我分享給所有的朋友 \o/

有所錯誤歡迎指教

全部文章列表