Reputation: 1
i was building this discord bot using discord.js v13 and everytime i run my code (that i completly did not rip off from https://www.youtube.com/watch?v=JMmUW4d3Noc&t=614s)
Here is my code: Package.json
"name": "Ceeby",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^13.6.0",
"dotenv": "^16.0.0"
}
}
Index.ts
import DiscordJS, { Intents, Message } from 'discord.js'
import dotenv from 'dotenv'
dotenv.config()
const client = new DiscordJS.Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
]
})
client.on("ready", () => {
console.log("Ceeby Is Active")
})
client.on('messageCreate', (Message) =>{
if(Message.content === 'ping'){
Message.reply({
content: 'pong',
})
}
})
client.login(process.env.TOKEN)
.ENV file
TOKEN=<THIS IS MY TOKEN HERE>
i already tried doing it twice, restarting, reinstalling everything and still the same problem. here is the error: `Error: Cannot find module 'node:events' Require stack:
Upvotes: 0
Views: 875
Reputation: 485
Discord.js V13 requires a node version greater than 16.9.0 and you are running a version older than that as node:events was introduced in node V16+(Unsure which one exactly) https://github.com/discordjs/discord.js
Upvotes: 2