Bot not coming online
My bot does not come online when i run this code
There is no error, nothing in the terminal. It just looks lik this. (I have imported dotenv and have a file named .env with the token inside a variable called TOKEN, i dont think thats the issue.)
I sent an image what the terminal looks like. Any help appreciated. PLS
15 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Post the full error stack trace, not just the top part!
- Show your code!
- Explain what exactly your issue is.
- Not a discord.js issue? Check out #useful-servers.
- Issue solved? Press the button!There seems to be a few things wrong with the code snippet here. Verify that you’re running the correct file with node. You should be getting a few errors in the console.
Discord is undefined, use new Client instead
Change the
part to
U can use the guidline to use the Client object, but it s important to know u can t use an undefined variable.
U must to choice between
const Discord = require('discord.js')
And your declaration with Client and GatewayIntentBitsHow do I check this
You check it by looking at your file tree and package.json
1)
node .
will run your "main" file as defined in package.json
2) If you have "main": "./index.js"
but you have bot.js
as the file you are trying to run, then you will receive the error of "Invalid main entry" so you would have to specify the correct file to run.
3) To run some diagnostic: use node
followed by the name of the file you are trying to start.there doesnt seem to be an issue with this, the only thing i can think of being wrong is when i set up the node project, i have to cd it to my onedrive, and then my desktop. if i just do cd desktop it says i cant find it
This is my package.json. another issue i think it could be is that i have to make the index.js when i open it in visual. Maybe theres something to do with that
Yeah i just like reset everything with a new set of files and the same thing is popping up
the OneDrive thing is the only thing i can think of affecting the files not working
also if you have any ideas here
Okay in that case open the project from that folder rather than where you opening it at.
That did not change anything
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View
followed the code perfectly, still not working
im just gonna give up at this point thanks for the help guys