簡體   English   中英

在我的 ubuntu 服務器上使用 discord 機器人時出錯

[英]Error using discord bot on my ubuntu server

我有一個 discord 機器人,在我的場所(Windows 10)它工作正常,但在服務器(Ubuntu Server 20)上它給了我以下錯誤。

當我收到來自服務器的聊天消息時發生錯誤,例如,在我的計算機上,我會閱讀消息並回復它,在服務器上,我收到錯誤。

(node:657201) UnhandledPromiseRejectionWarning: TypeError: (intermediate value).flatMap is not a function
    at Promise.all.events.map (/root/discordbot/node_modules/@typeit/src/logic/metadatas/MetadataStorage.ts:155:14)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:657201) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:657201) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.`

這是同一個項目,同樣的一切,我不知道會發生什么。

.flat().flatMap僅適用於 Node >= 11

好像您使用的是 Node 10,請嘗試將您的 Node 升級到版本 11+

您可以使用 nvm,通過運行此命令進行安裝

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

或者

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

然后運行nvm install node ,這將安裝最新的節點版本,你也可以像這樣指定版本nvm install 12.16.3

然后使用版本,要使用最新版本,運行nvm use node或使用特定安裝的版本,運行nvm install 12.16.3

然后通過運行node -v驗證您的節點版本

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM