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

243
Vistas
SyntaxError: Identifier 'client' has already been declared

im tryna make a discord bot. whenever i try to run it with cmd i get this:

error in cmd:

C:\Users\kaalj\OneDrive\Desktop\Bot>node main.js
C:\Users\kaalj\OneDrive\Desktop\Bot\main.js:7
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
      ^

SyntaxError: Identifier 'client' has already been declared
←[90m    at wrapSafe (internal/modules/cjs/loader.js:988:16)←[39m
←[90m    at Module._compile (internal/modules/cjs/loader.js:1036:27)←[39m
←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)←[39m
←[90m    at Module.load (internal/modules/cjs/loader.js:937:32)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:778:12)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)←[39m
←[90m    at internal/main/run_main_module.js:17:47←[39m

the code i got this far is: Package.json

{
  "name": "gerda",
  "version": "1.0.0",
  "description": "Gerda",
  "main": "= main.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Jordy",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^13.1.0"
  }
}

main.js:

const Discord = require('discord.js');

const client = new Discord.Client();

const { Client, Intents } = require('discord.js');

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });

client.once('ready', () => {
  console.log('Gerda is er');
});

client.login("Token");

anyone knows what i have to do to make it run? (in my code i actually have my token filled in)

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

as you can see on lines: 3 and 7 , on both you declared const which is called: client.

it is that simple.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You just need to remove the client declared at line number 3. You have already handled it in line 7 in detail. So delete line 3 and you're good.

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