Skip to content
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 upload canvas-v2.11.2-node-v108-darwin-unknown-arm64.tar.gz #2251

Closed
dmZhan opened this issue Jun 1, 2023 · 15 comments
Closed

Can't upload canvas-v2.11.2-node-v108-darwin-unknown-arm64.tar.gz #2251

dmZhan opened this issue Jun 1, 2023 · 15 comments

Comments

@dmZhan
Copy link

dmZhan commented Jun 1, 2023

--Hey, guys! I also had the same issue. Maybe you can try creating a .npmrc file under the project root path, specifying the mirror address of the canvas, like this: canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas
It worked for me and I hope it helps you.

--Originally posted by @Orange-001 in #2186 (comment)

I have a new problem. I did it the way you did it. It doesn't work because https://registry.npmmirror.com/-/binary/canvas/v2.11.2/canvas-v2.11.2-node-v108-darwin-unknown-arm64.tar.gz doesn't exist. And my device is a Mac with M2.

@bengyles
Copy link

bengyles commented Jun 2, 2023

Same issue on an M1 Macbook and the fix doesn't work either

@Orange-001
Copy link

Try removing node_modules and package-lock.json, then npm install

@arcticShadow
Copy link

Seems like canvas does not have prebuilt binaries for arm64 (Mac M1/M2's)

See the binaries that they provide here:
https://github.com/Automattic/node-canvas/releases

(I'm also searching for a solution at the moment)

@bengyles
Copy link

bengyles commented Jun 2, 2023

indeed the arm64 versions are not prebuilt, node gyp is installing them from source and giving this error:

Package pangocairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `pangocairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pangocairo' found
gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp

@Arkomus
Copy link

Arkomus commented Jun 2, 2023

the same with M1,
i search since 2 days, can't find anything that works

@bengyles
Copy link

bengyles commented Jun 5, 2023

fixed it by adding export PATH="/opt/homebrew/bin:$PATH" to ~/.zshrc. I think I have 2 installs of pkg-config and now the correct one is being used. Hope this fixes the issue for others as well

@jahamed
Copy link

jahamed commented Jun 5, 2023

export PATH="/opt/homebrew/bin:$PATH"

not working for me 😢, tried deleting yarn.lock and node_modules before too.

@Arkomus
Copy link

Arkomus commented Jun 5, 2023

export PATH="/opt/homebrew/bin:$PATH"

ne fonctionne pas pour moi😢, a essayé de supprimer yarn.lock et node_modules avant aussi.

i have found the answer after two days,
after this
https://github.com/nodejs/node-gyp/blob/main/docs/Force-npm-to-use-global-node-gyp.md

hoping it work for you

@fuchunhui
Copy link

fuchunhui commented Jun 17, 2023

when I successfully installed it, I smiled.
M2 + node v18.13.0

@fuchunhui
Copy link

fuchunhui commented Jun 17, 2023

  1. read this.

https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md

We need to start by knowing your version of npm:
npm --version

If your npm is version 7 or 8, do:

npm explore npm/node_modules/@npmcli/run-script -g -- npm_config_global=false npm install node-gyp@latest
  1. read this

https://github.com/Automattic/node-canvas/wiki/Installation%3A-Mac-OS-X
we solve this problem through the source code.

image

https://github.com/Automattic/node-canvas/wiki/Installation%3A-Mac-OS-X

Execute these commands:
brew install pkg-config cairo pango libpng jpeg giflib librsvg
image
ignore this case. then
npm install canvas

@EricLiuZero
Copy link

EricLiuZero commented Aug 23, 2023

I got the same issue.
my machine is MacBook Pro M1 2020.
trying @fuchunhui 's solution.
after executing brew install pkg-config cairo pango libpng jpeg giflib librsvg

I got the following message and try to install xcode-select

image

after install xcode-select, re-open vscode, remove node_modeul, and run pnpm i
image

eventually, [email protected] was installed successfully.

@zbjornson
Copy link
Collaborator

As most of you figured out, there are no prebuilds for ARM. There's info on building from source in the troubleshooting guide (#1511).

If you have an ARM CPU

Prebuilds aren't available for ARM. Please see the wiki for guides on building from source. See also node-gfx/node-canvas-prebuilt#69.

@sadewa25
Copy link

brew install pkg-config cairo pango libpng jpeg giflib librsvg

thanks for your solutions, this work for me

@cunneen
Copy link

cunneen commented Jun 7, 2024

I also had to install python-setuptools i.e.:

brew install pkg-config cairo pango libpng jpeg giflib librsvg python-setuptools

@7zf001
Copy link

7zf001 commented Aug 14, 2024

I also had to install python-setuptools i.e.:

brew install pkg-config cairo pango libpng jpeg giflib librsvg python-setuptools

Thank you for providing the solution, it resolved my issue, I had to install python-setuptools.
Mine is a 2021 M1, Version: 13.6.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests