MODULE_NOT_FOUND

Hello! I encountered a problem when trying to run my Discord.js bot. I don't know why I keep getting this error even though I upgraded the version of Discord.js (14.11.0 -> latest version). I also tried "clean install" by removing the node_modules dir and reinstalling all the dependencies. What should I do to fix this error? Here's the error message:
node index.js
node:internal/modules/cjs/loader:598
throw e;
^

Error: Cannot find module '\node_modules\@vladfrangu\async_event_emitter\dist\index.js'
at createEsmNotFoundErr (node:internal/modules/cjs/loader:1181:15)
at finalizeEsmResolution (node:internal/modules/cjs/loader:1169:15)
at resolveExports (node:internal/modules/cjs/loader:591:14)
at Module._findPath (node:internal/modules/cjs/loader:668:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (\node_modules\@discordjs\rest\dist\index.js:649:34)
at Module._compile (node:internal/modules/cjs/loader:1376:14) {
code: 'MODULE_NOT_FOUND',
path: '\\node_modules\\@vladfrangu\\async_event_emitter\\package.json'
}

Node.js v20.11.0
node index.js
node:internal/modules/cjs/loader:598
throw e;
^

Error: Cannot find module '\node_modules\@vladfrangu\async_event_emitter\dist\index.js'
at createEsmNotFoundErr (node:internal/modules/cjs/loader:1181:15)
at finalizeEsmResolution (node:internal/modules/cjs/loader:1169:15)
at resolveExports (node:internal/modules/cjs/loader:591:14)
at Module._findPath (node:internal/modules/cjs/loader:668:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (\node_modules\@discordjs\rest\dist\index.js:649:34)
at Module._compile (node:internal/modules/cjs/loader:1376:14) {
code: 'MODULE_NOT_FOUND',
path: '\\node_modules\\@vladfrangu\\async_event_emitter\\package.json'
}

Node.js v20.11.0
PS I removed the actual path of my workspace for security purposes
2 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Catharsis
CatharsisOP11mo ago
okay, i'll try here's the output:
[email protected] <workspace-path>\shaii-classic
├─┬ @discordjs/[email protected]
└── @vladfrangu/[email protected]
└─┬ @discordjs/[email protected]
└── @vladfrangu/[email protected] deduped
[email protected] <workspace-path>\shaii-classic
├─┬ @discordjs/[email protected]
└── @vladfrangu/[email protected]
└─┬ @discordjs/[email protected]
└── @vladfrangu/[email protected] deduped
Well, I simply run the npm i or npm install to reinstall all dependencies. Did I do something wrong? So, after I remove the node_modules dir, I just simply run npm i. Is this wrong? I think I fixed it. I don't know if it's true or not, but when I remove the node_modules dir and the package-lock.json file, and I try to reinstall all dependencies by running the npm i command, and I don't know how, but suddenly the bot can run. 🤷
Want results from more Discord servers?
Add your server