Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

304
Visualizações
Cannot Find Node:Events with discord.js

I'm trying to make a discord bot using discord.js (I have discord.js installed) but for some reason, I keep getting this weird error. I've looked through similar articles that address the same issue and suggested that I update my version of NodeJS to 16.6.0 or above (which I did) but have been unable to solve my issue. Any help would be much appreciated. Thank you.

code:

const Discord = require("discord.js")
const client = new Discord.Client()

client.on("ready", () => {
  console.log('Logged in as', client.user.tag)
})

client.on("message", msg => {
  if (msg.content == "ping") {
    msg.reply("pong");
  }
})

client.login(process.env.TOKEN)

error:

Error: Cannot find module 'node:events'
Require stack:
- /home/runner/name_file/node_modules/discord.js/src/client/BaseClient.js
- /home/runner/name_file/node_modules/discord.js/src/index.js
- /home/runner/name_file/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/runner/name_file/node_modules/discord.js/src/client/BaseClient.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Read this. This is definitely related to your Node.js version. If you did upgrade, check the version: type node -v in your command prompt / terminal and see what version it shows. Once I also had problems with node.js upgrades.

about 4 years ago · Juan Pablo Isaza Relatório

0

I came to know you are using replit. So you may uninstall discord.js from the replit Packages (you can find it in left bar t). And go to package.json change discord.js version 12.5.3 . "discord.js": "^12.5.3",. Then open shell and install discord.js@12.5.3 with npm install discord.js@12.5.3. After installing , run your code . It should work ! Thank You

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda