package.json
{
"name": "5ambot",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js",
"dev": "nodemon index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^13.5.0",
"dotenv": "^10.0.0"
},
"devDependencies": {
"nodemon": "^2.0.15"
}
}
when i run npm start i gett an error in internal/modules/cjs/loader.js:892
error
Error: Cannot find module 'node:events'
Require stack:
- DIR\node_modules\discord.js\src\client\BaseClient.js
- DIR\node_modules\discord.js\src\index.js
- DIR\index.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> (DIR\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: [
'DIR\\node_modules\\discord.js\\src\\client\\BaseClient.js',
'DIR\\node_modules\\discord.js\\src\\index.js',
'DIR\\index.js'
]
}
i tried reinstalling package-lock: -rm -rf node_modules package-lock.json && npm install && npm start
didn't work. I am out of ideas and everyone says its cuz the node version is too low and i saw no other solution. Please help
edit: i came to a conclusion that its the discord.js that isn't loading correctly with npm install discord.js
try
Delete node_modules run
npm cache clean --force
npm install
npm run start
or try yarn
yarn