Dropbox npm包未正确导入

Dropbox npm包未正确导入,npm,dropbox-api,Npm,Dropbox Api,我正在尝试找到dropbox示例代码 这是我正在使用的代码- var dropbox = require("dropbox") console.log("dropbox:",dropbox) console.log("dropbox.Client:",dropbox.Client) var client = new dropbox.Client({ key: "my-key", secret: "my-secret" }); client.authDriver(new d

我正在尝试找到dropbox示例代码

这是我正在使用的代码-

var dropbox = require("dropbox")

console.log("dropbox:",dropbox)
console.log("dropbox.Client:",dropbox.Client)

var client = new dropbox.Client({
    key: "my-key",
    secret: "my-secret"
});


client.authDriver(new dropbox.AuthDriver.NodeServer(8191));

client.authenticate(function(error, client) {
  if (error) {
    console.log('error')
    return
  }

   console.log("worked")

});
但我得到了这个错误输出-

Dropbox: function (options) {
  DropboxBase.call(this, options);
}
Dropbox.Client: undefined
/Users/11126/code/node/idea/ideadbapi/idea_bckp/bckp.js:6
var client = new Dropbox.Client({
             ^
TypeError: undefined is not a function
    at Object.<anonymous> (/Users/11126/code/node/idea/ideadbapi/idea_bckp/bckp.js:6:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3
Dropbox:函数(选项){
DropboxBase.call(此选项);
}
客户端:未定义
/Users/11126/code/node/idea/ideadbapi/idea_bckp/bckp.js:6
var client=new Dropbox.client({
^
TypeError:undefined不是函数
在对象上。(/Users/11126/code/node/idea/ideadbapi/idea\u bckp/bckp.js:6:14)
在模块处编译(Module.js:460:26)
在Object.Module.\u extensions..js(Module.js:478:10)
在Module.load(Module.js:355:32)
在Function.Module.\u加载(Module.js:310:12)
位于Function.Module.runMain(Module.js:501:10)
启动时(node.js:129:16)
在node.js:814:3

有人能帮忙吗?为什么dropbox.Client没有定义?

您试图使用已弃用/未维护的,但看起来您实际安装了更新的

无论如何,后者是首选的,因此您应该遵循以下文档:


您试图使用已弃用/未维护的,但看起来您实际安装了更新的

无论如何,后者是首选的,因此您应该遵循以下文档: