简体   繁体   中英

Cannot find module 'node:events'

when i started the code i've got this error

Error: Cannot find module 'node:events'
Require stack:
- C:\RAGEMP\server-files\node_modules\discord.js\src\client\BaseClient.js
- C:\RAGEMP\server-files\node_modules\discord.js\src\index.js
- C:\RAGEMP\server-files\packages\DominoRP\discord\index.js
- C:\RAGEMP\server-files\packages\DominoRP\index.js
- C:\RAGEMP\server-files\bin\loader.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.<anonymous> (C:\RAGEMP\server-files\node_modules\discord.js\src\client\BaseClient.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();

   
});

i have upgrade to node 16.13 but same thing. Can anyone help me?

You need to install it, it may not be available by default.

https://www.npmjs.com/package/events

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM