-
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
Can't run npm i canvas
on Apple Silicon
#2353
Comments
I'm not associated with this project or https://github.com/Brooooooklyn/canvas but I found that https://www.npmjs.com/package/@napi-rs/canvas is a great replacement for node-canvas. Instead of |
@coderfin Thank you! Will check that out |
you can build canvas from source, you will need python3/python3-dev packages + install requirements for canvas. if all required things are found, node-gyp should build canvas from source |
I was hitting this on my M2 mac and noticed it was trying to compile the binary for 2 reasons:
Because the download was failing for both reasons (I presume it would fail on an Intel mac running Node v21 as well because of (1)), npm was now wanting to compile a new binary. The compilation would then fail because of a missing Thankfully, I checked out the README and found that there are a bunch of compilation instructions (thank you -- would be great to mention this in the Release docs too, right after the Node version info...) for various platforms suggesting to run this on Mx macs:
During the install of
Hope this helps... |
I can confirm this, using Node 21 seems to be impossible at the moment as @stefcameron mentioned. Following the build instructions from the README I never really had problems building the canvas module on an MacBook Air with M1 for a long time until I switched to Node 21. Falling back to Node 20 the installation works. Maybe it's worth mentioning this also in the README. |
@coderfin goooosh, thanks a lot of that, man I've been bumping into different random issues with fonts for 2 days straight, switched to alternative and it JUST WORKS WOW OMG lifesaver |
If like me, you've get Kudos to this legend. |
@par5ul1 This worked for me, thanks! |
@par5ul1 that worked like magic, thanks! |
Issue or Feature
It seems
npm i canvas
fails on Apple Silicon machines. Any insights into how to fix?Steps to Reproduce
Your Environment
npm list canvas
oryarn list canvas
):On an M1 Ultra Mac Studio
macOS 14.3.1
node v21.6.2
npm v10.2.4
Full error is too long for Github comments so I added it here: https://media.yembo.ai/npm-error.txt
The text was updated successfully, but these errors were encountered: