Starting erorr xx

i get such an error when starting the bot.

Error: Cannot find module ‘timers/promises’
Require stack:

  • /root/testbot/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js
  • /root/testbot/node_modules/@discordjs/rest/dist/lib/RequestManager.js
  • /root/testbot/node_modules/@discordjs/rest/dist/index.js
  • /root/testbot/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object. (/root/testbot/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:6:20)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions…js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [
    ‘/root/testbot/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js’,
    ‘/root/testbot/node_modules/@discordjs/rest/dist/lib/RequestManager.js’,
    ‘/root/testbot/node_modules/@discordjs/rest/dist/index.js’,
    ‘/root/testbot/index.js’
    ]
    }

Hi @FoxLasy, welcome :slight_smile:

Can you show us the top of your /root/testbot/index.js file, where you have your require statements?

Also, can we see your package.json to check which modules you’ve imported?

If your project is public, it may be easier to tell us the project name :slight_smile:

index.js

package.json

Thanks for that!

This stack overflow answer suggests that it’s because you need to run on Node 16.x: discord.js - Error: Cannot find module 'timers/promises - Stack Overflow

To do that on Glitch, please add this section into your package.json:

"engines": { "node": "16.x" },

Hope it helps :slight_smile:

hello this problem has been solved but it gave another error.

config.json content

{
    "invite": "false",
    "discord_owner_id": "302871230485364738",
    "token": "test",
    "youtubeAPI": "test",
    "geniusLyricsAPI": "test",
    "tenorAPI": "test",
    "newsAPI": "test",
    "twitchClientID": "Your-Client-ID",
    "twitchClientSecret": "Your-Client-Secret",
    "rawgAPI": "test",
  }
{
    "invite": "false",
    "discord_owner_id": "302871230485364738",
    "token": "test",
    "youtubeAPI": "test",
    "geniusLyricsAPI": "test",
    "tenorAPI": "test",
    "newsAPI": "test",
    "twitchClientID": "Your-Client-ID",
    "twitchClientSecret": "Your-Client-Secret",
    "rawgAPI": "test"
  }

the rawgAPI had a comma at the end, which tells JSON that another value is supposed to go there

I fixed it for you above.

Happy coding!

1 Like