Well, after tumbling down a few rabbit holes, I was inspired to try installing the missing libraries using yum
or apt
.
That is an option on netlify, but suggested a hacky solution: manually including the libraries that would’ve been installed by copying them in place. So that’s what I’ve done.
This image is rendered from an SVG of my netlify function…
What did I do?
- spun up an Ubuntu Xenial 16.02 using multipass
brew install multipass
on MacOS
multipass launch --name netlify xenial
- created a shared mount to move files back to MacOS
mkdir libx86
multipass mount shared netlify: libx86
- started a bash session on the vm
multipass exec netlify bash
to start a session on the vm - installed the libraries required by node-canvas
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
- copied the missing libraries into the shared mount
cp /lib/x86_64-linux-gnu/{libblkid,libmount,libuuid}.so.1 libx86
- last step, modified the
netlify.toml
build command to copy those libs into the canvas node_module
cp ./libx86/* node_modules/canvas/build/Release/
Commit the result, push to github, then smile!
Good enough for now. Hope this helps someone.
Cheers,
ABK