4

I am trying to use canvas in a server less function on Vercel, but am running into an error I don't know how to get around:

Error: /lib64/libz.so.1: version ZLIB_1.2.9' not found (required by /var/task/api/node_modules/canvas/build/Release/libpng16.so.16)`

I have this in my package.json, but it appears to installed zlib 1.2.7:

  "scripts": {
    "vercel-build": "yum install libuuid-devel libmount-devel zlib && cp /lib64/{libuuid,libmount,libblkid,libz}.so.1 node_modules/canvas/build/Release/"
  },

As I see this in the build log zlib-1.2.7-18.amzn2.x86_64 already installed and latest version

How can I install 1.2.9 instead?

keegan3d
  • 10,357
  • 9
  • 53
  • 77

1 Answers1

0

I don't know if you found a solution but in case this is useful to anyone, downgrading canvas to v2.6.1 helped in my case. downgrading canvas might also require using node 14x instead of node 16 or higher because node-gyp tends to throw errors if you try to install canvas 2.6.1 on node 16 or higher.

Also might want to attach the build command to the additional vercel script. Like: "yum install libuuid-devel libmount-devel zlib && cp /lib64/{libuuid,libmount,libblkid,libz}.so.1 node_modules/canvas/build/Release/ && npm run build".

Nnanyielugo
  • 401
  • 4
  • 13