Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

290
Views
error when requiring discordjs - cannot find module 'node:events'

I'm trying to develop a bot to disagree. I installed the npm install discord.js --save library. But it is giving error to import it. Please, can someone help me

command node .

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

Error: Cannot find module 'node:events'
Require stack:
- C:\Users\Gobs\Desktop\blog3\node_modules\discord.js\src\client\BaseClient.js
- C:\Users\Gobs\Desktop\blog3\node_modules\discord.js\src\index.js
- C:\Users\Gobs\Desktop\blog3\main.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (C:\Users\Gobs\Desktop\blog3\node_modules\discord.js\src\client\BaseClient.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Gobs\\Desktop\\blog3\\node_modules\\discord.js\\src\\client\\BaseClient.js',
    'C:\\Users\\Gobs\\Desktop\\blog3\\node_modules\\discord.js\\src\\index.js',
    'C:\\Users\\Gobs\\Desktop\\blog3\\main.js'
  ]
}

JSON

{
...
"main": "main.js",
"scripts": {
},
"dependencies": {
    "discord.js": "^13.2.0"
}
...
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The required node.js version for discord.js is v16.6. Without it you could get errors such as

  • AbortController is not defined
  • Unexpected token '?'
  • Cannot find module 'node:events'

Simply just upgrade to v16.6 and these errors will be fixed.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!