我正在尝试在js中创建一个插件discord并添加包:discord image-generation,但我需要在我的PC上安装canvas,当我尝试运行它时,它会给我错误:
C:\Users\USER\node_modules\canvas\build\Release\canvas.node不是有效的Win32应用程序。
下面是我的代码:
const Discord = require("discordjs")
const client = new Discord.Client({ partials: ["MESSAGE", "CHANNEL", "REACTION" ]});
const DIG = require("discord-image-generation");
client.on("ready", () =>
{
});
client.on("message", message =>
{
let cmd = message.content.split(" ")[0]
cmd = cmd.slice(PREFIX.length)
let args = message.content.split(" ").slice(1)
if (cmd === "deletetrash")
{
message.delete()
const user = message.mentions.users.first()
if (!user) return window.BdApi.alert("? Eroge Notification ?",`You need mention someone. ❌`);
Delete();
async function Delete()
{
let image = await new DIG.Delete().getImage(user.avatarURL).then(image =>
{
message.channel.send({
files: [{
attachment: image,
name: "Delete.png"
}]
})
})
}
}
});
client.login(get_token.authToken).catch(() =>
{
return window.BdApi.alert("? Eroge Notification ?",`Oops, look like your token not working...`);
})我已经尝试了所有的解决方案,都没有效果,提前感谢您的帮助!
发布于 2021-07-15 22:14:50
这意味着canvas构建版本和nodejs版本不同。即x32 canvas build和x64 nodejs build。只需为您的节点版本构建canvas
https://stackoverflow.com/questions/68394657
复制相似问题