Visual Studio code Terminal - TypeError: Cannot read property 'execute' of undefined

Visual Studio code Terminal - TypeError: Cannot read property 'execute' of undefined

你好,我有一个问题我正在使用visual studio代码并且终端显示TypeError:无法阅读 属性 'execute' of undefined 谢谢

有人可以帮忙吗 - [1]: https://i.stack.imgur.com/Ax2Ra.png

for(const file of commandFiles){
    const command = require(`./commands/${file}`);

    client.commands.set(command.name, command);
}

client.on('message', message =>{
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if (command === 'ping'){
        client.commands.get('ping').execute(message, args);
    }
    if (command == 'youtube'){
        client.commands.get('youtube').execute(message, args);
    }
    if (command == 'instagram'){
        client.commands.get('instagram').execute(message, args);
    }
});

更改此行:

if (command === 'ping'){
    client.commands.get('ping').execute(message, args);
}

到这一行:

if (command == 'ping'){
    client.commands.get('ping').execute(message, args);
}

尝试改变

(command === 'ping')

(command == 'ping')