window 未在 opentok-text-chat 节点模块中定义

window is not defined in opentok-text-chat node module

我在 node js 工作。我使用 npm 安装了 opentok-text-chat。然后我开始使用节点 server.js,它 returns 出现以下错误:

E:\simerjit\dawai\node_modules\opentok-text-chat\dist\opentok-text-chat.js:14
    window.jQuery = $;
    ^

ReferenceError: window is not defined
    at Object.<anonymous> (E:\simerjit\dawai\node_modules\opentok-text-chat\dist
\opentok-text-chat.js:14:5)
    at Object.<anonymous> (E:\simerjit\dawai\node_modules\opentok-text-chat\dist
\opentok-text-chat.js:608:3)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (E:\simerjit\dawai\server\routes.js:28:32)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)

opentok-text-chat 库是一个客户端库,它可以帮助您将文本聊天功能添加到您的 opentok 应用程序中。

它不是服务器端节点库,因此当它试图访问节点中不存在的 window 对象时会导致此错误。

您可以在此处查看库文档快速入门 https://github.com/opentok/accelerator-textchat-js#quick-start

或在此处查看示例应用程序之一 https://github.com/opentok/accelerator-sample-apps-js