Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

586
Vistas
Invalid Bot Token, discord.js

I'm new to discord.js and I have no clue why I'm getting this error:

Uncaught Error [TOKEN_INVALID]: An invalid token was provided.

my bot.js file

    const { Client, Intents } = require('discord.js');
    const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
    
    client.on('ready', () => {
        console.log(`Successfully Logged in as ${client.user.tag}!`);
    });
    
    client.login(process.env.TOKEN);

.env file

TOKEN='my Bot token here'

I'm 100% sure that my bot token is correct/valid, I have also tried revoking it and copy-pasting the new token several times, but I still get the same error... I have searched up nearly everywhere on the net and I still haven't found a solution to my problem.

package.json file

{
  "dependencies": {
    "discord.js": "^13.6.0",
    "dotenv": "^16.0.0"
  }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Did you initialize the env to be used in your file?

You will have to use dotenv package.

Put require('dotenv').config() at the top of your file and you would be good to go

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda