Search code examples
node.jsdiscord.js

Discord.js v14.14.1 | EmbedBuilder is not defined


I've tried reinstalling my entire node_modules folder and still keep getting this error - ReferenceError: EmbedBuilder is not defined

Code:

const {  SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits, guild } = require('discord.js');
      module.exports = {
        data: new SlashCommandBuilder()
                .setName('test')
                .setDescription('test')
                .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
                .addChannelOption(option =>
                    option.setName('channel')
                        .setRequired(true)
                        .setDescription('Choose a channel to send this embed to.'),
                ),
        async execute(interaction) {
            const channel = interaction.options.getChannel('Channel');
            const embed = new EmbedBuilder()
                .setTitle("Title")
                .setDescription("Description")
                .setFooter({ text: `${guild.name}` });
            await channel.send({ embed: [embed] });
            await interaction.reply({
                content: 'Embed has been sent',
                ephemeral: true,
            });
        },
    };```

Solution

  • Try to delete your package-lock.json and check your package.json that it's Discord.js v14.14.1