Need help with Discord Bot

Hi,

I forked this Disco Bot
It was running fine until a week ago, now getting errors not sure what’s up.
Maybe I need to update something or something has changed?

Thanks

 node index.js
internal/modules/cjs/loader.js:818
throw err;
^

Error: Cannot find module ‘node:events’
Require stack:

  • /home/runner/deep-house/node_modules/discord.js/src/client/BaseClient.js
  • /home/runner/deep-house/node_modules/discord.js/src/index.js
  • /home/runner/deep-house/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. (/home/runner/deep-planet/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)
     node index.js
    internal/modules/cjs/loader.js:818
    throw err;
    ^

Error: Cannot find module ‘node:events’
Require stack:

  • /home/runner/deep-house/node_modules/discord.js/src/client/BaseClient.js
  • /home/runner/deep-house/node_modules/discord.js/src/index.js
  • /home/runner/deep-house/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. (/home/runner/deep-planet/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) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [
    ‘/home/runner/deep-house/node_modules/discord.js/src/client/BaseClient.js’,
    ‘/home/runner/deep-house/node_modules/discord.js/src/index.js’,
    ‘/home/runner/deep-house/index.js’
    ]
    }
    exit status 1

You forked an old non-nix repl, so your node.js version is too low. Add ?migrateNonNix=1 to your repl’s URL, then update node.js by running in shell:

sed -i 's/12/18/' replit.nix

@UMARismyname

Where exactly do I add this ?migrateNonNix=1

replit.com/@Emar1/deep-house?migrateNonNix=1

Do I need a replit.nix file in my project? there is none.

~/deep-house$ sed -i ‘s/12/18/’ replit.nix
sed: can’t read replit.nix: No such file or directory

yeah, it should automatically add it after the migrateNonNix process finishes though

So I need to run this URL in the browser first replit.com/@Emar1/deep-house?migrateNonNix=1

https://deep-planet.mixlive.repl.co/?migrateNonNix=1

Unable To Wake Up

The repl didn’t wake up in time. Please try again in 30 seconds

~/deep-planet$ sed -i ‘s/12/18/’ replit.nix
sed: can’t read replit.nix: No such file or directory

I forked it again, the repl url goes to hello world! page.
Then ran sed -i 's/12/18/' replit.nix which said it was updating environment.

 node index.js
http://localhost:3000
Status: Connected to discord
DiscordAPIError: 404: Not Found
at RequestHandler.execute (/home/runner/deep/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
method: ‘get’,
path: ‘/channels/’,
code: 0,
httpStatus: 404

Whatever I did, the bot appears to stay online now in Discord, however.
I’m seeing these error messages in the console / terminal

 node index.js
http://localhost:3000
Status: Connected to discord
DiscordAPIError: 404: Not Found
at RequestHandler.execute (/home/runner/open-stage/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
method: ‘get’,
path: ‘/channels/’,
code: 0,
httpStatus: 404
}

It seems like there is an error related to a missing module ‘node:events’. This error is occurring in the Discord.js module’s ‘BaseClient.js’ file, which is being called from your ‘index.js’ file.

This error could be caused by a number of different things, but it is likely related to a version incompatibility or missing dependency issue. Here are a few things you can try to fix this issue:

  1. Check your package.json file to make sure that all dependencies and versions are up-to-date.
  2. Run ‘npm install’ command in your terminal to install any missing dependencies.
  3. Make sure that you are running a version of Node.js that is compatible with the version of Discord.js that you are using.
  4. Try removing the ‘node_modules’ folder and then running ‘npm install’ command again to reinstall all dependencies.

If none of these solutions work, you can try reaching out to the Discord.js community for help or checking the Discord.js documentation for more information.

~/deep-planet$ npm install
audited 163 packages in 4.635s

7 packages are looking for funding
run npm fund for details

found 18 vulnerabilities (2 low, 3 moderate, 13 high)
run npm audit fix to fix them, or npm audit for details

The problem I find is if I run npm audit fix
It says something about updating environments,
But when it’s done I can’t start the app at all, there’s loads of new errors.

Hm. I suggest you contact the Replit support team.

Ok, I’ll give them a shout.

They said use the forum,
Can anyone fork this app and possibly take a look at it?
I can’t understand what all these errors mean.

@EMar1 Thank you for joining us here at Replit Ask. Sorry I couldn’t help you though.

Seriously? You use the forum, nobody can solve it so you go ask replit, and they say use the forum. Did you already clarify that nobody solved the problem?

1 Like

I did and they said they’ll take a look at the issue,
I just think it’s a nice little app that does a decent job, just sits in a discord chat re-streaming a shoutcast station, which is cool, maybe people have it installed on Repl, but they’re using the old code. I got it working again last night but it’s not perfect, there’s still errors.