slackbots npm package returning SyntaxError: Unexpected end of JSON input

slackbots npm package returning SyntaxError: Unexpected end of JSON input

Slackbots 包在我的 Node.js slack bot 应用程序没有任何修改的情况下停止为我工作。启动时我收到错误:

Error: SyntaxError: Unexpected end of JSON input

输出自:

bot.on('error', function (err) {
    console.log("error connecting to slack " + err);
});

使用节点版本 6.11.3

在浏览了 Slackbots 包代码后,我开始阅读有关 Slack API 方法 rtm.start 的内容,在那里我发现了一行

Please use rtm.connect instead, especially when connecting on behalf of an Enterprise Grid customer.

因为我是 Enterprise Grid 客户,所以我将 index.js 中用于 Slackbot 软件包的行更改为以下内容

this._api('rtm.start').then...this._api('rtm.connect').then... 然后一切又开始工作了。