Reputation: 61
I updated my code to v13 today and now when i try to start my discord bot i'm getting an error, but when i go back to v12 this error is not anymore here.. https://pastebin.com/9puJMkSQ This is my code
constructor(guild) {
this.guild = guild;
const storagePath = "./root/DiscordMusicGiveawayBotNew/storage/"
if (!fs.existsSync(storagePath)) {
fs.mkdirSync(storagePath);
}
const myStorage = "./root/DiscordMusicGiveawayBotNew/storage/" + this.guild.name;
if (!fs.existsSync(myStorage)) {
fs.mkdirSync(myStorage);
}
const dirPath = './root/DiscordMusicGiveawayBotNew/storage/' + this.guild.name + "/giveaways";
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath);
}
const dir = fs.opendirSync(dirPath);
What's wrong with it? It work perfectly in v12, but when i change to v13 it return an error that prevent us to start our code
Upvotes: 0
Views: 2313
Reputation: 6665
I believe you need to pass the recursive: true
option. I don't think this is related to NodeJS version tho.
fs.mkdirSync(storagePath, { recursive: true })
Upvotes: 1