Ask coding questions

← Back to all posts
Discord bot.
KooralYT

I need help. I keep popping up one error all the time and I don't know what to do.

Voters
KooralYT
Comments
hotnewtop
Highwayman

I'm not seeing that error, but you do have another error when parsing the package.json file. It's pretty easy to fix though: Just add a comma to the end of line 7 and it'll parse I'm pretty sure.

=>

KooralYT

@Highwayman the same problem

Highwayman

Hm. Maybe it’s the nodjs version that replit comes with? That’s been a problem before…
Try making a nodjs16 repl using the Nodejs-16 template repl and then put your code in that, and maybe it’ll work.
@KooralYT

KooralYT
Highwayman

The error ENOENT means that the requested file could not be found. Looking at the error, they give us the file and the line in parentheses:

@ Object.<anonymous> (/home/runner/BotDC-1/.config/interp.js:195:19)

So on line 195 of the file .config/interp.js, we will find our error:

the line is this:

And the variable mainPath is defined on line 98 as:

So, the problem is there… you can either make the index.js file or just change the mainPath variable to be another file.
@KooralYT

Nedia

Try "npm install" in the shell.

KooralYT
Nedia

@KooralYT Okay so it seems like you did something wrong during setup and so the Replit is broken since it can't install discord.js. Make a new Replit please.

Nedia

@KooralYT Oh and also you just leaked your Discord token to the world.

KooralYT

@Nedia this is fake token

KooralYT

@Nedia Your idea has no effect but tomorrow I think it will be with you

Nedia

@KooralYT Does the code work?

KooralYT

@Nedia yeah this is the basic code to run the discord bot

Nedia

@KooralYT Buddy you need to learn some more javascript

KooralYT

@Nedia well, you can help me how to fix it, don't you?

Nedia

@KooralYT Just make a new Replit and copy the code and run it

Nedia

@KooralYT Oh and also make sure you have your token in Replit secrets

KooralYT

@Nedia the same problem :(

KooralYT

@Nedia what is that "Error: Cannot find module 'node:events'"

Nedia

@KooralYT It can't find the module which is why I suggested npm install.

KooralYT

@Nedia but it doesn't help

KooralYT

@Nedia the same appears all the time at startup and with npm install