-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Canvas won't run in a docker container #2413
Comments
I'm facing the same issue. If you manage to solve it, let me know. |
I managed to solve the problem. The issue lies in the node_modules folder. Once Canvas is installed in node_modules on the local machine (in my case, Windows), and you try to create the Docker image from your local machine, for some reason, Canvas throws an error. I believe it signs something in its package specific to that environment, and when the Docker image is generated, it tries to use the node_modules from the PC, causing an issue. Either you delete the node_modules folder from the project before generating the Docker image, or you add a .dockerignore file and ignore node_modules, similar to how .gitignore works. |
I already have a dockerignore file with node_modules in. Would you mind sharing your dockerfile? |
Use the Node.js base imageFROM node:20 Install system dependencies necessary for native modules like
|
This unfortunately did not resolve my issue. I still am receiving the same error. |
Access the node-canvas documentation -> https://www.npmjs.com/package/canvas |
I'm only using the createCanvas method. |
I added |
Issue or Feature
I've been trying to get canvas to work in a docker container, running a discord bot. I can install canvas without issues, the problem is canvas won't run. Nor on node:20 nor node:20-alpine. Has anyone had this happen to them and possibly knows a solution to this? Here's the error I'm getting
libjpeg8 is no longer part of debian nor alpine. I tried installing it but that didn't work either. Then I tried installing
libjpeg62-turbo
and create a symlink, but that didn't work either.The code runs fine outside of my container (on my arch machine).
Steps to Reproduce
Here's my docker container:
Your Environment
npm list canvas
oryarn list canvas
): canvas@2.11.2The text was updated successfully, but these errors were encountered: