title: const commandFolders = readdirSync('./commands'); ReferenceError: Cannot access 'readdirSync' before initialization at Object.<anonymous> error
body: <p>I got this error today trying to change a little bit of my command handler from an youtube video.The video is from april and it seems to work for the guy but for me it doesnt.I tried many things but i didnt get any clue.Im not pretty good with this but i want to have an start like many others and this comunity is so good an helps me so much, thank you so much for the support you offer to me!!I hope i will get past this problem.                             <a href="https://i.stack.imgur.com/oJMjz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oJMjz.png" alt="enter image description here" /></a></p>
  <pre><code>
  
  
  
  const Timeout = new Discord.Collection();
  
  
  const bot = new Discord.Client(); 
  
  
  const prefix = '$';
  
  bot.commands = new Discord.Collection();
  const commandFolders = readdirSync('./commands');
  
  
  const ms = require('ms');
  
  const {readdirSync , read} = require('fs');
  
  for(const folder of commandsFolders){
      const commandFiles  = readdirSync(`./commands/${folder}`).filter(file =&gt; file.endsWith('.js'));
      for(const file of commandFiles){
          const command = require(`./commands/${folder}/${files}`);
          bot.commands.set(command.name, command);
      }
  }
  
  bot.on(&quot;error&quot; , console.error);
  
  
  bot.once('ready' , () =&gt; {
      console.log('M-am trezit din morti!');
  });
  
  bot.on(&quot;message&quot; , async (message) =&gt;{
       if(message.author.bot) return;
       if(message.channel.type === 'dm') return;
  
       if(message.content.startsWith(prefix)){
           const args = message.content.slice(prefix.length).trim().split(/ +/);
  
           const commandName = args.shift().toLowerCase();
  
           const command = bot.command.get(commandName) || bot.commands.find(cmd =&gt; cmd.aliases &amp;&amp; cmd.aliases.includes(commandName));
           if(!command) return;
  
           if (command) {
               if(command.cooldown){
                   if(Timeout.has(`${command.name}${message.author.id}`)) return  message.channel.send(`Te rog asteapta! \`${ms(Timeout.get (`${command.name}${message.author.id}`) - Date.now(), {long: true})}\`Pana folosesti comanda din nou!`);
                   command.run(bot, message, args)
                   Timeout.set(`${command.name}${message.author.id}` , Date.now() + command.cooldown)
                   setTimeout(() =&gt;{
                       Timeout.delete(`${coomand.name}${message.author.id}`)
                   }, command.cooldown)
               } else command.run(bot, message, args); 
           }
       }
  })
  </code></pre>