Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

314
Views
I'm trying to create a discord bot but I am unable to run it with 'node index.js'. How do I fix this?

This is the code I created to run the bot (I'm still very new to coding so I apologize, and the token was regenerated so don't worry):

const Discord = require('discord.js');
const { Client, Intents } = require ('discord.js');
const client = new Discord.Client({ intents: [Intents.FLAGS.GUILDS] })

client.on('ready', () => {
  console.log(`We are now online!`);
});

client.on('message', msg => {
  if (msg.content === '!help') {
    msg.reply('Help yourself.');
  }
});

client.login('j1mz8eMBhKcgY4yZEzbXG4sxuniVB0AY');

This is the warning I received when I used 'node index.js':

(node:64810) UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined
    at RequestHandler.execute (/Users/Name/Desktop/Bots/node_modules/discord.js/src/rest/RequestHandler.js:172:15)
    at RequestHandler.execute (/Users/Name/Desktop/Bots/node_modules/discord.js/src/rest/RequestHandler.js:176:19)
    at RequestHandler.push (/Users/Name/Desktop/Bots/node_modules/discord.js/src/rest/RequestHandler.js:50:25)
    at async WebSocketManager.connect (/Users/Name/Desktop/Bots/node_modules/discord.js/src/client/websocket/WebSocketManager.js:128:9)
    at async Client.login (/Users/Name/Desktop/Bots/node_modules/discord.js/src/client/Client.js:245:7)
(Use `node --trace-warnings ...` to show where the warning was created)

I'm not sure what to do to fix this.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!