Discord Bot runs fine but after some days it just stops

So my discord bot runs fine but then after some days, it goes offline. and when i look at the program logs at glitch, it shows this error. i have to clone the whole project to get the bot up running again

throw err;
Error: Cannot find module ‘discord.js’
Require stack:

  • /app/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15)
    at Function.Module._load (internal/modules/cjs/loader.js:526:27)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object. (/app/index.js:4:17)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions…js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:826:10

Have you tried reinstalling discord.js?

i am new to programming,how do u do that

npm i discord.js in the terminal should work.

1 Like

thank you, i will do it as soon as the terminal is running. it shows failed to start terminal

1 Like

Welcome to the community anujpflash!
Try using enable-pnpm to fix this issue. Or you forgot to add discord.js at the package.json?

1 Like