Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported

Hi everyone, I'm trying to read all commands from my command's folder but I can't seem to get it to work.
const commands = [];
const cwd = process.cwd();
const commandsDir = join(cwd, './src/Commands');

for (const file of readdirSync(commandsDir)) {
const { default: Command } = await import(join(commandsDir, file));
commands.push(Command.data.toJSON());
client.commands.set(Command.data.name, Command);
}
const commands = [];
const cwd = process.cwd();
const commandsDir = join(cwd, './src/Commands');

for (const file of readdirSync(commandsDir)) {
const { default: Command } = await import(join(commandsDir, file));
commands.push(Command.data.toJSON());
client.commands.set(Command.data.name, Command);
}
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:' any help would be appreciated
1 Reply
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View