Node:events module not found

After successfully updating my system, my bot started producing an error message. Additionally, I received a warning after installing a new version of Node through the shell. Despite having Node version 17.1.0, my search for a solution to the error message “cannot find module node:events” only led me to suggestions to upgrade to Node version 16.6.

Question:

Upon commencing the coding, an error was encountered.

Error: Cannot find module 'node:events'
Require stack:
- C:RAGEMPserver-filesnode_modulesdiscord.jssrcclientBaseClient.js
- C:RAGEMPserver-filesnode_modulesdiscord.jssrcindex.js
- C:RAGEMPserver-filespackagesDominoRPdiscordindex.js
- C:RAGEMPserver-filespackagesDominoRPindex.js
- C:RAGEMPserver-filesbinloader.mjs
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:893:15)
    at Function.Module._load (internal/modules/cjs/loader.js:743:27)
    at Module.require (internal/modules/cjs/loader.js:965:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object. (C:RAGEMPserver-filesnode_modulesdiscord.jssrcclientBaseClient.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:1076:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:941:32)
    at Function.Module._load (internal/modules/cjs/loader.js:782:14)
    at Module.require (internal/modules/cjs/loader.js:965:19)

this is my code

const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', async () => {
   console.log('!!! => Discord bot has authenticated successfully...');
   sendMsgToServerStatus();
   
});

After upgrading to Node version 16.13, I am still facing the same issue. Is there anyone who can provide me with assistance?


Solution:

Installation is required as it may not be readily accessible.

The website “npmjs.com” hosts a package called “events”.

Frequently Asked Questions