This code worked completely fine about an hour ago, then suddenly it didn’t. I started randomly getting this error:
"
C:\Program Files\nodejs\node.exe .\index.js
Process exited with code 1
Uncaught Error: Cannot find module ‘Discord.js’
"
I have tried the following:
-Uninstalling discord.js, then reinstalling it.
-Checking to see if the ‘Discord’ should be capitalised or not.
-Changing the version on the ‘version’ of my package.json.
-Completely rewriting my code from scratch in a new file.
-Reducing the code to just that first line of code.
(Edit: I also tried running Visual Studio Code in administrator mode and I tried tweaking the code such that I provided an exact file location instead of just ‘discord.js’. Again, neither of these worked.)
None of these have worked. I am basically brand new to coding (hence the very simple code) and just fancied messing around with it, but I have genuinely no idea what caused my issue or how to fix it as I have checked everything I can think of.
So in raw defiance to this useless community, I now have a working bot, although admittedly I just found a guide that worked (previous ones didn’t, I still don’t know why), then copied their code. The guide can be found here:
Maybe installing ‘discord.io’ directly into the same folder as the code might have been the fix ? Although I’m not sure why that would be it if fiddling with the directory didn’t work ?
Either way, I hope this helps anyone with the same issue !