0

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

Error: Cannot find module 'node:events'
Require stack:
- D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\node_modules\discord.js\src\client\BaseClient.js
- D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\node_modules\discord.js\src\index.js
- D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\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> (D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\node_modules\discord.js\src\client\BaseClient.js:3:22)
   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:\\UserProfile\\Users\\Administrator\\Desktop\\misc\\SerriedZ V.2\\node_modules\\discord.js\\src\\client\\BaseClient.js',
   'D:\\UserProfile\\Users\\Administrator\\Desktop\\misc\\SerriedZ V.2\\node_modules\\discord.js\\src\\index.js',
   'D:\\UserProfile\\Users\\Administrator\\Desktop\\misc\\SerriedZ V.2\\index.js'
 ]
}

I'm getting this error while running node . to run the discord bot, I have tried to fix it by using npm i node:events but didn't seem to fix.

Serried
  • 11
  • 2
  • 1
    Does this answer your question? [error when requiring discordjs - cannot find module 'node:events'](https://stackoverflow.com/questions/69489101/error-when-requiring-discordjs-cannot-find-module-nodeevents) – MrMythical Jan 17 '22 at 03:22

1 Answers1

1

It might be because you are running an older version of Node.js. Try upgrading to a later version.

From Discord.js docs:

Node.js 16.6.0 or newer is required

https://discord.js.org/#/docs/discord.js/stable/general/welcome

  • I have updated it but so I tried running it and it threw this instead. throw new TypeError('CLIENT_MISSING_INTENTS'); ^ TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client. at Client._validateOptions (D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\node_modules\discord.js\src\client\Client.js:548:13) at new Client (D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\node_modules\discord.js\src\client\Client.js:76:10) at Object. (D:\UserProfile\Users\Administrator\Desktop\misc\SerriedZ V.2\index.js:3:16) – Serried Jan 17 '22 at 01:00
  • 2
    This is a new error, if the error related to the post has been fixed mark this question with the checkmark. – Elitezen Jan 17 '22 at 01:11
  • As @Elitezen said, you should ask a new question, but this [answer](https://stackoverflow.com/a/68701506/14253032) might lead you in the right direction. – Erik Uusitalo Jan 17 '22 at 01:23