我在命令提示符下安装了以下包:
npm install -g ar-drone然后通过Node.js点击
var arDrone = require(‘ar-drone’);它让我无法找到模块’ar-drone’
一世 …
检查模块是否已下载 /usr/local/lib/node_modules 如果你使用ubuntu。这是node_modules的全局位置。
/usr/local/lib/node_modules
您也可以尝试在本地目录中安装。
是的我必须将所有代码从index.js传输到repl.js.我的repl.js看起来像这样并且有效。
let arDrone = exports; exports.Client = require('./lib/Client'); exports.UdpControl = require('./lib/control/UdpControl'); exports.PngStream = require('./lib/video/PngStream'); exports.UdpNavdataStream = require('./lib/navdata/UdpNavdataStream'); exports.createClient = function(options) { let client = new arDrone.Client(options); client.resume(); return client; }; exports.createUdpControl = function(options) { return new arDrone.UdpControl(options); }; exports.createPngStream = function(options) { let stream = new arDrone.PngStream(options); stream.resume(); return stream; }; exports.createUdpNavdataStream = function(options) { let stream = new arDrone.UdpNavdataStream(options); stream.resume(); return stream; }; let client = arDrone.createClient(); client.createRepl();