I updated the node and discord.js version of my bot(Hosted on Repl.it), and since then I can not seem to use the DiscordJS Library. I have two bots I am using, one is working properly even though it is like the latest version while the other one, which I updated, is not working properly. So I thought there must be something wrong with my Repl(Project), so I created a new one. However, that still does not work. It throws the error:
Require stack:
- /home/runner/Bot/node_modules/discord.js/src/client/BaseClient.js
- /home/runner/Bot/node_modules/discord.js/src/index.js
- /home/runner/Bot/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/Bot/node_modules/discord.js/src/client/BaseClient.js:3:22)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
I tried to debug it myself and first omit the DiscorJS Library and run the program with a console.log()
statement, and it works without an error. So there is something wrong with either NodeJS or DiscordJS. Why is this happening?
I found the solution after some more debugging.
npm install node@16
in the shell..replit
and type run = "npx node index.js"
in it.
Now try to run the file. It should work with the DiscordJS Library