-1
Basically, I am working on a Discord bot, and at the moment I am creating the Helder command, but for some reason, readdirSync does not recognize the folder that stores the files of the commands
const fs = require('fs');
client.commands = new Discord.Collection();
const arquivosComandos = fs.readdirSync('./comandos/').filter(file => file.endsWith('.js'));
The result is "Error: ENOENT: no such file or directory, scandir './commands/'"
I also tried to follow suggestions I saw here on Stackoverflow, like using path and __dirname, but it didn’t help
const path = require('path');
const dirPath = path.resolve(__dirname, './comandos/');
const fs = require('fs');
client.commands = new Discord.Collection();
const arquivosComandos = fs.readdirSync(dirPath).filter(file => file.endsWith('.js'));
This time, the answer is "Error: Cannot find module './commands/0'"
I also tried using path.Join(), same error
The bizarre thing is that when I ask someone else to run my code to see if it’s something missing from bundle or IDE, the folder is usually recognized
Any idea what it might be?