我试图在运行Ubuntu 12.04的Beaglebone上运行Node Arduino库[https://github.com/rwldrn/johnny-five]。但是,每当我尝试运行示例程序(servo.js或任何其他程序)时,控制台都会吐出:
/home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/node_modules/bindings/bindings.js:91
throw err
^
Error: Could not locate the bindings file. Tried:
→ /home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/build/serialport.node
→ /home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/build/Debug/serialport.node
→ /home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/build/Release/serialport.node
→ /home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/out/Debug/serialport.node
→ /home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/Debug/serialport.node
→ /home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/out/Release/serialport.node
→ /home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/Release/serialport.node
→ /home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/build/default/serialport.node
→ /home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/compiled/0.8.15/linux/arm/serialport.node
at bindings (/home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/node_modules/bindings/bindings.js:88:9)
at Object.<anonymous> (/home/rov/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/serialport.js:7:44)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/home/rov/node_modules/johnny-five/node_modules/firmata/lib/firmata.js:9:18)
at Module._compile (module.js:449:26)
我尝试通过npm安装序列端口(npm install serialport),但仍然出现相同的错误。如何安装serialport,以便它可以被Servo.js文件识别?
最佳答案
serialport
是johnny-five
和firmata
的依赖项,但是由于firmata
本身是johnny-five
的依赖项,我相信firmata
会引用johnny-five / node_modules中的serialport
。
另请注意,serialport
requires Python 2.x。
如果npm正确安装了johnny-five
,它应该已经将serialport.node内置到johnny-five / node_modules / serialport / build / Release中-在那看到吗?
如果没有,请在新目录中尝试$ git clone https://github.com/rwldrn/johnny-five
$ cd johnny-five
$ npm install
它成功了吗?
将/ home / rov / node_modules / johnny-five替换为您刚刚构建的克隆存储库。