Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs

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


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: 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

1 year ago
You are viewing a single comment. View All

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.

1 year ago