【问题标题】:Cassandra client error on NodeJSNodeJS上的Cassandra客户端错误
【发布时间】:2019-01-23 13:02:53
【问题描述】:

尝试在 nodejs 应用程序中使用 cassandra 驱动程序 3.5。通过 cassandra.Client({}) 实例化客户端时,会出现以下错误:

TypeError: Cannot read property 'bind' of undefined
at Object.Client (....path..../lambdas/data-upload/node_modules/cassandra-driver/lib/client.js:307:63)

客户端代码第307行是:

this.options = clientOptions.extend({ logEmitter: this.emit.bind(this) }, options);

所以“this.emit.bind”是它失败的地方。

环境是节点 8.10(也尝试过 8.11)和驱动程序版本 3.5(尝试过 3.4 但具有相同的代码)。

【问题讨论】:

    标签: node.js cassandra


    【解决方案1】:

    经过大约 8 小时的挖掘,发现了问题。我不是在“新”上课。

    我在做:

    const client = cassandra.Client(....)  
    

    而不是(正确的)

    const client = new cassandra.Client(....)
    

    【讨论】:

      猜你喜欢
      • 2012-02-22
      • 2012-07-04
      • 2015-02-19
      • 1970-01-01
      • 2021-12-23
      • 1970-01-01
      • 2022-10-23
      • 2015-06-21
      • 2018-05-03
      相关资源
      最近更新 更多