我正在尝试在运行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,但我仍然遇到同样的错误。如何安装serialport以便伺服.js文件可以识别它?
答案 0 :(得分:1)
serialport
是johnny-five
和firmata
的依赖,但由于firmata
本身是johnny-five
的依赖关系,我相信firmata
会引用serialport
来自johnny-five / node_modules的johnny-five
。
另请注意serialport
requires Python 2.x。
如果npm正确安装$ git clone https://github.com/rwldrn/johnny-five
,它应该将 serialport.node 构建到 johnny-five / node_modules / serialport / build / Release - 你看到了吗?在那里?
如果没有,请在新目录中尝试此操作
$ cd johnny-five
$ npm install
成功吗? 将 / home / rov / node_modules / johnny-five 替换为您刚刚构建的克隆仓库。