Help me with an unexpected error!!!

node:internal/modules/cjs/loader:1189
throw err;
^

Error: Cannot find module 'commands\8-ball.js'
Require stack:
- D:\testtestbot\deploy-commands.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1186:15)
at Module._load (node:internal/modules/cjs/loader:1012:27)
at Module.require (node:internal/modules/cjs/loader:1271:19)
at require (node:internal/modules/helpers:123:16)
at Object.<anonymous> (D:\testtestbot\deploy-commands.js:30:19)
at Module._compile (node:internal/modules/cjs/loader:1434:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1518:10)
at Module.load (node:internal/modules/cjs/loader:1249:32)
at Module._load (node:internal/modules/cjs/loader:1065:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'D:\\testtestbot\\deploy-commands.js' ]
}

Node.js v22.2.0
node:internal/modules/cjs/loader:1189
throw err;
^

Error: Cannot find module 'commands\8-ball.js'
Require stack:
- D:\testtestbot\deploy-commands.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1186:15)
at Module._load (node:internal/modules/cjs/loader:1012:27)
at Module.require (node:internal/modules/cjs/loader:1271:19)
at require (node:internal/modules/helpers:123:16)
at Object.<anonymous> (D:\testtestbot\deploy-commands.js:30:19)
at Module._compile (node:internal/modules/cjs/loader:1434:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1518:10)
at Module.load (node:internal/modules/cjs/loader:1249:32)
at Module._load (node:internal/modules/cjs/loader:1065:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'D:\\testtestbot\\deploy-commands.js' ]
}

Node.js v22.2.0
my D:\testtestbot\deploy-commands.js: https://sourceb.in/o6TK1zBkQJ and my D:\testtestbot\commands\8-ball.js: https://sourceb.in/nzmSq84Hhi
SourceBin
deploy-commands.js
Instantly share your code with the world.
SourceBin
8-ball.js
Instantly share your code with the world.
18 Replies
d.js toolkit
d.js toolkit•4w 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!
chewie 🌈
chewie 🌈•4w ago
the path is wrong
BMmarci1234
BMmarci1234•4w ago
it is correct i think but what is wrong?
chewie 🌈
chewie 🌈•4w ago
the path is not correct as I just pointed out
BMmarci1234
BMmarci1234•4w ago
I t I am pretty sure it is correct
chewie 🌈
chewie 🌈•4w ago
great
BMmarci1234
BMmarci1234•4w ago
but what is the problem with it?
chewie 🌈
chewie 🌈•4w ago
it should be ./commands/8-ball.js, yet it's commands/8-ball.js
BMmarci1234
BMmarci1234•4w ago
in which file?
chewie 🌈
chewie 🌈•4w ago
in your deploy-commands file?
BMmarci1234
BMmarci1234•4w ago
ok I'll will try it now. 1 min in which line?
chewie 🌈
chewie 🌈•4w ago
19 presumably?
BMmarci1234
BMmarci1234•4w ago
so is it D:\testtestbot\deploy-commands.js:19? the 19th line: commandFiles.push(path.join(dir, file.name));
chewie 🌈
chewie 🌈•4w ago
yes
BMmarci1234
BMmarci1234•4w ago
so how should I correct this line?
chewie 🌈
chewie 🌈•4w ago
you tell me not really djs related
BMmarci1234
BMmarci1234•4w ago
... sorry I don't really know that how should I fix this or discord.js problem is it. so what should I do? should I close this chat and open else or what? pls answer
Retro
Retro•4w ago
commands/8-ball.js refers to the module "commands" not the directory "commands". like Capybacca pointed out, its not really a djs problem.