Discord.js error that gets fixed on update is always coming back

I host a Discord bot on Glitch using Discord.js and i use the master branch of it: github:discordjs/discord.js.
There was an error that started appearing (invalid token error) and updating discord.js should fix it. I removed the node_modules folder using the console and reinstalled everything. It worked, but after some time the error appears again, and if i reinstall the modules again it works… but stops again later. What could be happening?

Hey! There was some issues with master version.

But as you said it appears again after some time, it is because Glitch performs fresh install every 12 hours and which is probably reverting back to older version.

To Fix:

  • Go To Console.
  • Run enable-pnpm (it will restart your app) [Wait for completion].
  • Then run pnpm install discordjs/discord.js.
  • At last, run refresh.
1 Like