注意:我通常用Python编写代码,所以我对javascript完全陌生.
我试图使用以下回购协议:https://github.com/omerdn1/otter.ai-api
我使用了设置代码,但我用以下代码替换了导入:const OtterApi = require('otter.ai-api')
,因为我得到了SyntaxError: Cannot use import statement outside a module
.
然而,现在我得到了以下错误:TypeError: OtterApi is not a constructor
.如果我看一下索引.在回购协议中,它看起来像一个构造器吗?守则的第一部分是:
class OtterApi {
constructor(options = {}) {
this.options = options;
this.user = {};
this.csrfToken = '';
}
init = async () => {
await this.#login();
};
我正在try 运行的代码:
const OtterApi = require('otter.ai-api');
const otterApi = new OtterApi({
email: 'email', // Your otter.ai email
password: 'pw', // Your otter.ai password
});
async function main() {
await otterApi.init() // Performs login
}
main();
我使用new OtterApi()
时会出错.我不知道如何解决这个问题.