Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

407
Vistas
Cannot find module 'node:events' error thrown when running discord bot

Here is my basic source code, I'm just trying to get the bot online:

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

client.once('ready', ()=> {
    console.log('Bot is online')
});

client.login('token');

When I run the program it throws an error:

internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module 'node:events'
Require stack:
- D:\Eclipse\Workspace\discordbot\src\node_modules\discord.js\src\client\BaseClient.js
- D:\Eclipse\Workspace\discordbot\src\node_modules\discord.js\src\index.js
- D:\Eclipse\Workspace\discordbot\src\main.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> 
(D:\Eclipse\Workspace\discordbot\src\node_modules\discord.js\src\client\BaseClient.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [

'D:\Eclipse\Workspace\discordbot\src\node_modules\discord.js\src\client\BaseClient.js', 'D:\Eclipse\Workspace\discordbot\src\node_modules\discord.js\src\index.js', 'D:\Eclipse\Workspace\discordbot\src\main.js' ] }

I'm currently have node 17.0.0, and using Eclipse. Node is in my path environment. My package JSON file is:

{
  "name": "discordbot",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1"
 },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^13.2.0",
    "node": "^17.0.0"
 }
}

I have looked at similar issues and none of the answers seemed to have fixed the issue. Discord says that v 16.10.0 or higher will work. Thanks for your time.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In order to upgrade node you need to install it globally, not just within the current package. Typically this is done by downloading the installer, or by using your preferred package manager.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda