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

334
Vistas
discord.js SyntaxError: Unexpected token?

I'm doing the discord.js getting started bot but I always get this error: SyntaxError: Unexpected token? the error code i get

This is the code I used, actually just copy and paste from their tutorial just switched to dotenv for the token...

 // Require the necessary discord.js classes
require("dotenv").config();
const { Client, Intents } = require('discord.js');

// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

// When the client is ready, run this code (only once)
client.once('ready', () => {
    console.log('Ready!');
});

// Login to Discord with your client's token
client.login(process.env.TOKEN);

These are the versions of discord.js and dotenv I'm using. Node version is 12.8.0

    "dependencies": {
    "discord.js": "^13.1.0",
    "dotenv": "^10.0.0"
  }

Already thanks for your help guys!

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

0

So the first thing to note is that your error is coming from node_modules. That means that the code that is erroring is code that you've imported from npm to do something. Because it's not your code and rather third party code that probably works, that means that the error most likely has to do with either your version of that code or the way you're using that package is incorrect.

My best guess would be that it has to do with some advanced syntax that the package is using, but that errors on your machine because you have version incompatibility. I'd recommend updating your node version and trying again. Let us know if that fixes the problem!

Download latest node version: https://nodejs.org/en/download/

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