Error: Cannot find module './commands/${file}'
So I'm currently making a Discord bot and when I tried to turn it on, the console showed this error and it didn't turn on.
Error: Cannot find module './commands/${file}'
Require stack:
- /home/runner/TerraBot/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at /home/runner/TerraBot/index.js:23:19
at Script.runInContext (vm.js:130:18)
at Object. (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
And I don't really know how to fix this.
Can someone help me, please?
Voters
[deleted]
Hi @Hplr63 I saw your repl and your bot's token is in it. Repls are public and anyone can view it. I would suggest you to go to https://docs.repl.it/repls/secret-keys and hide your token. And regenerate it or anyone can use it.
CodyMarkix
@Zapdos Thanks a lot! I noticed it after posting it and decided to hide it in an .env file!
CodyMarkix
@KHZ lemme try that. I'll give you an update
Update: It worked! Thanks for answering!
I'm a total newbie when it comes to Discord.js
wher repl