Dropbox npm 包未正确导入
Dropbox npm package is not getting imported properly
我正在尝试找到 here.
的保管箱示例代码
这是我正在使用的代码 -
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.Client 未定义?
您正在尝试使用 deprecated/un-maintained dropbox-js library, but it looks like you actually installed the newer dropbox-sdk-js library。
后者是首选,因此您应该遵循该文档:
我正在尝试找到 here.
的保管箱示例代码这是我正在使用的代码 -
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.Client 未定义?
您正在尝试使用 deprecated/un-maintained dropbox-js library, but it looks like you actually installed the newer dropbox-sdk-js library。
后者是首选,因此您应该遵循该文档: