Node-canvas error || cannot open shared object file: No such file or directory

Hey there, @citylights :wave:

Thanks for chiming in and sharing that method two from your post worked! This will definitely be beneficial for future Forums members. :netliconfetti:

1 Like

So close to getting this figured out using all the help here so far but I hit a snag with this error:

The module '/var/task/node_modules/canvas/build/Release/canvas.node'\nwas compiled against a different Node.js version using\nNODE_MODULE_VERSION 93. This version of Node.js requires\nNODE_MODULE_VERSION 72. Please try re-compiling or re-installing\nthe module (for instance, using `npm rebuild` or `npm install`).","trace":["Error: The module '/var/task/node_modules/canvas/build/Release/canvas.node'","was compiled against a different Node.js version using","NODE_MODULE_VERSION 93.

I feel it should be relatively easy compared to the other errors I’ve been able to overcome and perhaps it requires setting a specific NPM_VERSION environment variable. Unfortunately, that didn’t do it.
My netlify.toml contains:

  publish = "public"
  command = "npm rebuild && cp ./libx86/* node_modules/canvas/build/Release && npm run debug"

so I’m lost on it still asking me to do a rebuild.

I also included and in my libx86 folder, not sure how important that is. Still no luck yet :stuck_out_tongue:

Fixed this by downgrading from node v16 to v14 . A friend that used to work with Netlify made me aware that Functions does not support versions over 14 for now

Hello. Can we get eyes on this issue again?

canvas continues to crash with
“Error - cannot open shared object file: No such file or directory”

I’ve tried everything here and this solution no longer works.

First of all. Xenial is no longer supported by multipass. If you want to try to make xenial builds than you’ll need to use docker.

Second. the so files were located in /lib/aarch64-linux-gnu/

I’ve tried both xenial and focal versions. Tried various node versions. And built all the so and copied them to the release folder and I’m still getting an error

Hey @vinh-perfectstorm,

We’ve replied in the helpdesk. Let us know if you want to continue the discussion here.