Error using discord bot on my ubuntu server Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Error using discord bot on my ubuntu server without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I have a discord bot, on my premises (Windows 10) it works correctly, but on the server (Ubuntu Server 20) it gives me the following error.

The error occurs when I receive a chat message from the server, that is, for example, on my computer, I would read the message and reply to it, on the server, I get the error.

(node:657201) UnhandledPromiseRejectionWarning: TypeError: (intermediate value).flatMap is not a function
    at (/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.`

It’s the same project, the same everything, I don’t know what can happen.


.flat() and .flatMap are only available on Node >= 11

Seems like you are using Node 10, try upgrading your Node to version 11+

You can use nvm, install by running this command

curl -o- | bash


wget -qO- | bash

then run nvm install node, this will install latest node version, you can also specify the version like this nvm install 12.16.3

then use the version, to use the latest version, run nvm use node or to use specific installed version, run nvm install 12.16.3

Then verify your node version by running node -v

We are here to answer your question about Error using discord bot on my ubuntu server - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji