'How can I fix this "missing module" error (node.js/discord.js)?

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 :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source