M
M
Muhendalf12020-11-05 18:09:42
Node.js
Muhendalf1, 2020-11-05 18:09:42

How to solve node js modules error?

Shalom, such a problem, I decided to make a discord bot using node.js and discord.js and faced such a problem when starting.

Error code

(node:3336) UnhandledPromiseRejectionWarning: ReferenceError: slice is not defined
    at Client.<anonymous> (C:\Users\Muhendalf\Desktop\MoaningSlavesRadio\index.js:26:37)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\Muhendalf\Desktop\MoaningSlavesRadio\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Muhendalf\Desktop\MoaningSlavesRadio\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\Muhendalf\Desktop\MoaningSlavesRadio\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\Muhendalf\Desktop\MoaningSlavesRadio\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\Muhendalf\Desktop\MoaningSlavesRadio\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\Muhendalf\Desktop\MoaningSlavesRadio\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\Muhendalf\Desktop\MoaningSlavesRadio\node_modules\ws\lib\websocket.js:797:20)
(node:3336) 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(). To terminate the node process on unhandled promise rejection,
use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)


I connected the FS module for some commands to work and ran into this problem, does anyone know how to solve it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question