Skip to content
Sign upLog in
← Back to Community

Discord.js Canvas error: libuuid.so.1: cannot open shared object file: No such file or directory

Profile icon
ASOwnerYT

Hello,
I'm trying to use the npm package Canvas with my Discord bot (Node.js 16 running with Nix on my Replit), and when I run my bot I get the following error:

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/asowneryt-discord-bot/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) { code: 'ERR_DLOPEN_FAILED' } exit status 1

I install Canvas by running this command in the shell: npm install canvas

Voters
Profile icon
tree12211
Profile icon
KhaiDuy2
Profile icon
isman712
Profile icon
TypedFlame9830021
Profile icon
ASOwnerYT
Comments
hotnewtop
Profile icon
Sheikhboi

worked

Profile icon
SixBeeps

What version of canvas are you running? I'm running 2.8.0 on a Nodejs Repl and it seems to be working for me. Also, try installing it through the packages tab.

Profile icon
ASOwnerYT

@SixBeeps
I'm running 2.8.0 too. I can't seem to find a packages tab, probably because I have to use Nix because my bot requires FFMPEG.

Profile icon
SixBeeps

@ASOwnerYT
Ohhh right. I believe the binary that it's looking for only exists on Node Repls, but since you're running Nix, try adding the pkgs.libuuid derivation.

Profile icon
ASOwnerYT

@SixBeeps
Didn't work, it had the same error :(

Profile icon
yofiss

@ASOwnerYT
Did you ever find a fix for this? I have the same issue.

Profile icon
NinjaCoderTech

@yofiss
same

Profile icon
AbstruseTheReal

@NinjaCoderTech
Any solution?

Profile icon
yofiss

@NinjaCoderTech

{ pkgs }: {
deps = [
pkgs.nodejs-16_x
pkgs.libuuid
];
env = {
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [pkgs.libuuid];
};
}

This in the replit.nix fixed it for me.

Profile icon
yofiss

@AbstruseTheReal

@NinjaCoderTech

{ pkgs }: {
deps = [
pkgs.nodejs-16_x
pkgs.libuuid
];
env = {
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [pkgs.libuuid];
};
}

This in the replit.nix fixed it for me.

Profile icon
AbstruseTheReal

@yofiss
Damn thanks buddy! I actually shifted my project to UNIX but I'm glad I can go back to NIX now xD

Profile icon
NinjaCoderTech

@yofiss
i did that now but even though there are no errors, my bot doesnt start!

Profile icon
OFFICIAL-DITTAZ

thanks

Profile icon
RadicLand

THANKS YOU BROOO <33333333

@yofiss

Profile icon
Suurlemoen

@NinjaCoderTech
same...

Profile icon
omegacrash316

ty ily


@yofiss