-
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
Error: /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /opt/nodejs/node_modules/canvas/build/Release/libpng16.so.16) #1779
Comments
Getting the same error running on Vercel Node 14 :/ |
I made some tests:
|
I had also tried to inject the correct zlib version with no luck. Will circle back when I have some time. At this moment, Canvas v2.6.1 is working fine for me. |
I built Canvas v2.8.0 from source on Amazon Linux 2, and now published the packaged layer on AWS Serverless Application Repository (https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:990551184979:applications~lambda-layer-canvas-nodejs). Hope this layer could help. |
I've got the same issue running on Vercel |
this seems to happen based on there is a two possible solutions:
to properly fix this in canvas i think the libs linking to libz should ensure they can differentiate, e.g. by linking against |
set LD_PRELOAD works for me ! |
How do I do this in Vercel? |
as @JeffersonSchuler said, use |
didn't work for me on AWS lambda with nodejs14.x |
I am using it in a Layer, not sure if it makes a difference. |
The solution that works on Lambda with node 14.x and [email protected] :
That's it ! |
When deploying through Netlify I was able to just install regularly through npm and didn't need a special layer, but customized the |
Thanks for doing the layer, this worked for me. I was already using a layer for some of the bigger packages like canvas and did not want to package them into the main function deployment. I tried the two environment variable solutions suggested here with no luck. |
I really want to ship these layout changes but continue to have issues with zlib (see Automattic/node-canvas#1779) which I won't have the capacity to investigate or solve for at least a few weeks. Hiding these features and merging until I can look into it fully.
I really want to ship these layout changes but continue to have issues with zlib (see Automattic/node-canvas#1779) which I won't have the capacity to investigate or solve for at least a few weeks. Hiding these features and merging until I can look into it fully.
I really want to ship these layout changes but continue to have issues with zlib (see Automattic/node-canvas#1779) which I won't have the capacity to investigate or solve for at least a few weeks. Hiding these features and merging until I can look into it fully.
I really want to ship these layout changes but continue to have issues with zlib (see Automattic/node-canvas#1779) which I won't have the capacity to investigate or solve for at least a few weeks. Hiding these features and merging until I can look into it fully.
Did you figure this out? I'm stuck. |
Not sure if it helps, if you need the latest features, but as above. Sorted it for me on Vercel by using |
The issue was |
Hi, were you able to resolve it. I am trying to run worpress starter with some custom pages. But getting the above error though everything runs well locally. |
adding |
Not related to Vercel but using Canvas in Node14 we experienced this same problem on our build server; downgrading to 2.61 resolved the issue for us. |
For people wanting this on Vercel. Due to Iterative Static Regeneration and the dynamic loading you can get with Vercel in general, you need to set LD_LIBRARY_PATH properly for all instances of the Vercel processes that are spawned, not just the initial buildscript. // For building on vercel: https://github.com/Automattic/node-canvas/issues/1779
if (
process.env.LD_LIBRARY_PATH == null ||
!process.env.LD_LIBRARY_PATH.includes(
`${process.env.PWD}/node_modules/canvas/build/Release:`,
)
) {
process.env.LD_LIBRARY_PATH = `${
process.env.PWD
}/node_modules/canvas/build/Release:${process.env.LD_LIBRARY_PATH || ''}`;
} Adding this to the top of next.config.js made Vercel build the project for me, and it will hopefully carry over to any processes spawned in the future that also has to load next.config.js. |
I can't believe, it perfectly works. Thank you so much @SimplyLinn |
@SimplyLinn and @arrokh what "now-build" script are you using? The proposed solution for Vercel didn't work for me 😥 I'm still seeing the following error:
and the "now-build" script that I'm using is:
I'm using |
Using canvas@^2.8.0. {
"build": "yarn bootstrap && next build",
"bootstrap": "run-p -l --silent --aggregate-output bootstrap:*",
"bootstrap:robots-txt": "NODE_ENV=production node bootstrap-robots.js",
} The bootstrap process is just doing some robots.txt schenanigans based on stuff and places it in the public folder and has little to do with the canvas library Install command override configured in vercel: Since you were using canvas@^2.7.0, I'd suggest you try latest version of canvas maybe? Otherwise I'm out of advice. |
Where is the Netlify solution? canvas : ^2.11.2, node: v16.20.2 LTS (in Netlify) |
this answer worked for me too, thanks for linking! |
I'm having issue with |
Downgrade to what? |
I'm using canvas 2.8 and node 16 on vercel and confirm that it works.
Em dom., 22 de out. de 2023 8:43 PM, Neha Rathi ***@***.***>
escreveu:
… @thomasvalera <https://github.com/thomasvalera> I am using ***@***.***,
at first It was failing because vercel is using node 18 as default. When I
set the LD_LIBRARY_PATH I started getting GLIBC_2.28 but the downgrade
fixed it.
Downgrade to what?
—
Reply to this email directly, view it on GitHub
<#1779 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACH7OTZYK4SHTT6C4YLNAS3YAWVSZAVCNFSM42MHYDD2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZXGQZDGMZXGY3Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Downgrade to Node 16 |
@abdullah-live I successfully replaced Here is a great example on how to use it. |
most of the solutions above require to downgrade to node 16 so we basically have 3 months left until we find a solution for v18 |
If anyone is coming due to Add this to
This will simply stub the |
@johncalvinroberts Did you make fabric work with next js 14 app route? Can you please share an example of your configuration? I've been trying almost every solution out there, but nothing seems to work |
please, i'm having the same problem with fabricjs and nextjs 14 when I try to deploy on vercel. If someone can do it work, i'd love some help. |
Upgrade Nodejs version from v16 to v20 works for me! |
you are a NextJS 14? i'm stuck with this error with hours, if you could help me |
You can try upgrade nodejs version to 20. |
Yeah, using NodeJS version 20, worked for me too!! |
Using this? |
Ok this worked now
|
This one worked for me as well using:
...after day of struggling to find the solution. It is weird since react-konva is proposing to update the Hard coding this But nevertheless it seems like non of the official docs are actually describing the right solution for the node-canvas issue and how to solve it the right way, It is really strange, since a lot of libs are built on top of it. 🤔 For now this workaround seem to work. |
I got it working with vercel after much trial and error using: Next: latest |
Hey bro,Have you solved it? |
@iyhub Have you tried this? |
after lots of trial and error and misleading lazy solutions that requires downgrading. I can confirm that Node 20 on vercel which is beta work with me unlike 18 and 16 which is almost expired. node: 20 |
Thank you very much! This worked for me on:
In brief, if you're looking for a quick summary: navigate to your project settings on Vercel, locate the General section, switch the Node.js Version from 18.x to 20.x, rebuild your project, and that's all it takes! |
When running on AWS Lambda using Node 14 with Canvas v2.7.0 I am seeing the following error:
Error: /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /opt/nodejs/node_modules/canvas/build/Release/libpng16.so.16)
I am successfully running on Node 14 using Canvas v2.6.1, but wanted to upgrade. This library is a dependency of
ChartjsNodeCanvas which is ultimately what I am calling.
Thanks.
The text was updated successfully, but these errors were encountered: