Getting DNS error when executing js script with Node

const { Client, EmbedBuilder, GatewayIntentBits, Collection, Events, Partials } = require("discord.js");
require("dotenv").config();
const { Guilds, GuildMembers, GuildMessages } = GatewayIntentBits;
const { User, Message, GuildMember, ThreadMember } = Partials;
const client = new Client({
    intents: [Guilds, GuildMembers, GuildMessages],
    Partials: [User, Message, GuildMember, ThreadMember]
});
client.login(process.env.DISCORD_BOT_TOKEN);

This is my index.js
When I execute node index.js, it gives me this error:

Error: getaddrinfo EAI_AGAIN discord.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
  errno: -3001,
  code: 'EAI_AGAIN',
  syscall: 'getaddrinfo',
  hostname: 'discord.com'

I tried to contact my internet provider, and they said they found nothing weird or errors in my modem.
They suggested asking here what I could do.

I tried changing DNS from automatic to google nameservers and vice versa, but it did not work.
Does someone know how to fix this? Its really annoying!

EXPECTATION:

I executed node index.js, and it should execute the script and put the bot online. I have this issue on my home network & mobile hotspot, not networks like work or school.

  • 1

    Does this answer your question? What’s the cause of the error ‘getaddrinfo EAI_AGAIN’?

    – 

  • On your home network and mobile hotspot, but using the same computer? In that case, the issue is with your computer. Possibly antivirus software.

    – 

  • @jabaa I tried that and it didnt work, sadly

    – 

  • @robertklep there is not like an antivirus that i installed myself. and it works on public wifi connections so idk if that is really the problem

    – 

Leave a Comment