javascript 不一致. js和记录:错误代码:无法打开共享目标文件:无此文件或目录

wtlkbnrh  于 2023-01-16  发布在  Java
关注(0)|答案(2)|浏览(128)

在我添加level.js文件到我的命令文件夹并运行机器人后,它显示了错误:

node:internal/modules/cjs/loader:1183
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: libuuid.so.1: cannot open shared object file: No such file or directory
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/home/runner/UnfortunateDistortedEngine/node_modules/canvas/lib/bindings.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/home/runner/UnfortunateDistortedEngine/node_modules/canvas/lib/canvas.js:9:18)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) {
  code: 'ERR_DLOPEN_FAILED'
}

level.js文件代码:

const { client, CommandInteraction, MessageEmbed } = require("discord.js");
const db = require('quick.db')
const canvacord = require("canvacord");
const Levels = require('discord-xp')

module.exports = {
  name: "level",
  description: "Displays the user's level and XP.",
  type: 'CHAT_INPUT',
  options: [
    {
      name: "member",
      type: "USER",
      description: "Specify a user.",
      required: false
    }
  ],
  run: async (client, interaction, args) => {
    let user1 = message.author;
    const Blacklisted = db.fetch(`blacklistedUsers_${user1.id}`)
    if (Blacklisted === true) return;
    let target = await interaction.options.getUser('member')
    let mentionedMember = target || interaction.user;
    const user = await Levels.fetch(mentionedMember.id, interaction.guild.id, true)

    const rank = new canvacord.Rank()
      .setAvatar(mentionedMember.displayAvatarURL({ format: 'png', size: 512 }))
      .setCurrentXP(mentionedMember.xp || 0)
      .setRequiredXP(Levels.xpFor(user.level + 1) || Levels.xpFor(1))
      .setRank(user.position)
      .setLevel(user.level)
      .setStatus(mentionedMember.presence.status)
      .setBackground("IMAGE", "https://i.pinimg.com/originals/22/90/0f/22900f16a05211e2562828b6b3fe86b7.jpg")
      .setProgressBar("#FFFFFF")
      .setUsername(mentionedMember.username)
      .setDiscriminator(mentionedMember.discriminator);

    rank.build()
      .then(data => {
        const attachment = new MessageAttachment(data, "RankCard.png");
        interaction.followUp({
      files: [attachment]
    })
      });
    
  }
}

在GitHub上已经有一个issue被打开了,但是打开程序没有说明任何解决方案,只是说“已解决”。这与使用canvas的Canvacord包有关。

kcrjzv8t

kcrjzv8t1#

您需要libuuid,它是node-canvas的依赖项,而node-canvas又是canvacord的dev依赖项,它通常预装在许多Linux系统中,尽管您可以使用

apt-get install libuuid1

要安装它,这应该解决问题,请注意,如果您使用的是repl.it这样的主机,而您没有root访问权限,则可能必须使用Nix

jbose2ul

jbose2ul2#

  • 好吧,如果你使用replit,它显示的错误...所以,我建议你改变你的replit.nix与下面给出的nix它肯定会解决你的问题!*
{ pkgs }: {
deps = [
pkgs.nodejs-16_x
pkgs.libuuid
];
env = {
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [pkgs.libuuid];
};
}

相关问题