TypeError: fs.reddirSync is not a function

TypeError: fs.reddirSync is not a function

这是我的代码,我不确定我做错了什么。

const fs = require('fs')

module.exports = (client, Discord) =>{
    const command_files = fs.reddirSync('./commands/').filter(file => file.endWith('.js'));
    
    for(const file of command_files){
        const command = require(`../commands/${file}`);
        if(command.name){
            client.commands.set(command.name, command);
        } else {
            continue;
        }
    }
}

正确的方法是readdirSync,你有reddirSync:

const command_files = fs.reddirSync('./commands/').filter(file => file.endWith('.js'));

正确的词:

const command_files = fs.readdirSync('./commands/').filter(file => file.endWith('.js'));