1

Here's the code, I was trying to run a discord bot file.

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

Error: Cannot find module 'node:events'
Require stack:
- /path/bot/node_modules/discord.js/src/client/BaseClient.js
- /path/bot/node_modules/discord.js/src/index.js
- /path/bot/index.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> (/path/bot/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: [
    '/path/bot/node_modules/discord.js/src/client/BaseClient.js',
    '/path/bot/node_modules/discord.js/src/index.js',
    '/path/bot/index.js'
  ]
}

What module would be missing? I haven't really fiddled around with node.js much, or discord.js, so I have no idea what could be going wrong. Plz help :)

MiSt Rocky
  • 13
  • 4

1 Answers1

0

If you're using discord.js version 13+ you need to upgrade to Node.js version 16.+. Otherwise you won't be able to run the bot

Simply visit Node.js and either install the LTS (recommended) version or the current

Toasty
  • 1,850
  • 1
  • 6
  • 21