我一直试图通过node-red-node-arduino按照Node-Red自己的指南(https://nodered.org/docs/hardware/arduino)在Node-Red中安装arduino节点无济于事。节点标记为安装在"管理托盘中。选项卡,但它被禁用并拒绝启用它自己。我试图插入上面链接的示例代码,但Node-Red没有识别它。我安装了包arduino-firmata和node-red-node-serialport,以及所有包本地(〜/ .node-red / node_modules)和全局(通过npm中的-g选项),但情况保持不变。
cd ~/.node-red
npm install node-red-node-arduino
npm install arduino-firmata
npm install node-red-node-serialport
sudo npm -g install node-red-node-arduino
sudo npm -g install arduino-firmata
sudo npm -g install node-red-node-serialport
但是,至少在本地安装时,它们会吐出一些奇怪的日志。
> serialport@4.0.3 install /home/myusername/.node-red/node_modules/serialport
> node-pre-gyp install --fallback-to-build
[serialport] Success: "/home/myusername/.node-red/node_modules/serialport/build/Release/serialport.node" is installed via remote
/home/myusername/.node-red
├── arduino-firmata@0.3.4
├── node-red-node-arduino@0.0.9
├── node-red-node-serialport@0.4.0
└── serialport@4.0.3
npm WARN enoent ENOENT: no such file or directory, open '/home/myusername/.node-red/package.json'
npm WARN .node-red No description
npm WARN .node-red No repository field.
npm WARN .node-red No README data
npm WARN .node-red No license field.
npm WARN In serialport@4.0.3 replacing bundled version of minimist with minimist@0.0.8
npm WARN In serialport@4.0.3 replacing bundled version of abbrev with abbrev@1.0.9
npm WARN In serialport@4.0.3 replacing bundled version of delegates with delegates@1.0.0
...
以下是在终端中运行node-red时显示的日志。
[warn] [arduino] Error: Cannot find module 'firmata/node_modules/serialport'