在Android上运行

使用Termux应用可以轻松在安卓设备上运行 Node-RED。直接从他们的github获取或通过F-Droid这里Termux on F-Droid

请注意,Play商店版本不再维护。

Note : the Node-RED team have no connection with the Termux application nor its development, nor F-Droid. We cannot provide support for it in any way, other than to say that at this point in time it works.

安装

安装后运行它。然后在提示符处输入

apt update
apt upgrade
apt install coreutils nano nodejs
npm i -g --unsafe-perm node-red
node-red

然后您可以在浏览器中访问 http://localhost:1880

请注意,安装openssh可能会让与termux的交互变得更简单一些。查看此线程了解此类安装的说明。

注意事项

  • 你也可以通过标准方式npm安装其他node-red节点,例如node-red-dashboard

    cd ~/.node-red
    npm i node-red-dashboard
    

    或者通过Pallete Manager安装。

  • volume-down键对应的是ctrl键 - 因此vol-down-c可用于"中断"正在运行的应用程序。
  • 上述指令还会安装nano编辑器,该工具可用于编辑文件。

自动启动

在Termux中启动应用程序的推荐方式是使用Termux:Boot应用(可从F-droid获取 - 请注意Play商店版本可能未维护,建议使用与安装termux相同的来源)。

我们发现另一个应用在开机自启动Termux时很有用 - Autostart - No Root (注意:使用termux:boot功能时,似乎不需要其他自启动应用)。

请注意,node-red脚本中的shebang与termux:boot脚本不兼容。解决方法是使用类似以下的termux:boot启动脚本来启动node-red:

#!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
node /data/data/com.termux/files/usr/bin/node-red

设备接入

您可以通过使用额外的Termux设备插件直接访问设备上的各种硬件 - 然后可以通过Node-RED中的exec节点进行访问。

注意:你需要在Termux中同时安装附加应用和附加API。

从获取Termux的同一来源安装附加应用 - Termux:API。

在Termux中安装附加访问权限

apt install termux-api