Open da-du opened 1 year ago
Same issue of 404 at https://github.com/Automattic/node-canvas/releases/download/v2.11.0/canvas-v2.11.0-node-v108-darwin-unknown-arm64.tar.gz
node v18.12.1 macOS 12.6
Fixed for me: brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
Fixed for me:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
But is it the right way to install so many packages?
Fixed for me:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
But is it the right way to install so many packages?
It's related to #2036 and other similar issues. Currently it still seems to be impossible to build a self contained version of canvas, so you have to install dependencies by other means.
I am running into this myself trying to run with Node.js 18 on Windows. There were no issues upgrading my Linux systems to Node.js 18 and "npm rebuild" worked fine. I am currently using Node.js 16.19.0 on Windows and it works fine. However, I just learned that the Node.js organization has moved the end-of-life for Node.js 16 forward seven months to September 2023, due to the OpenSSL end-of-life, so I realized I needed to look at Node.js 18 sooner than later for Windows.
UPDATE: I found the issue and it is rather odd. On Linux, everything works fine. "npm rebuild" updates the code to the latest Node platform. But on Windows it kept failing. Just for fun, I wiped the node_modules directory and did an "npm i". That worked. The correct node-canvas for Node 18 downloaded.
can reproduce - macbook m1 ventura on a docker container any fixes? have tried everything from a source build to an npm ci
Hey, guys! I also had the same issue. Maybe you can try creating an .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.
Hey, guys! I also had the same issue. Maybe you can try creating an .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.
Wow, bro, you're so cool! I installed it in the Windows environment for two days without success until I used your method!
大家好!我也有同样的问题。也许您可以尝试在项目根路径下创建一个 .npmrc 文件,指定画布的镜像地址,如下所示:
canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas
它对我有用,希望对您有所帮助。
it work for me too.
In case someone is upgrading to Nodejs v18, upgrade might be the solution
Fixed for me:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
But is it the right way to install so many packages?
Looks it's expected way based on the canvas documentation - https://github.com/Automattic/node-canvas/wiki/Installation%3A-Mac-OS-X
Fixed for me:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
But is it the right way to install so many packages?
Looks it's expected way based on the canvas documentation - https://github.com/Automattic/node-canvas/wiki/Installation%3A-Mac-OS-X
I have several Raspberry's that I use with node-canvas. Finally created myself a tiny bash script to handle it:
#!/bin/bash
read -p "Do you want to install the libraries for node-canvas? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo Installing packages required for installation of node-canvas
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
fi
There was a reason the -dev packages were required but I have forgotten.
Fixed for me:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
Mine is m1, this method helped me solve the problem
I have the same issue, running
yarn install --ignore-optional
has fixed it for me for now. Canvas is only an optional dependency for react-pdf it seems
Fixed for me:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
This doesn't fix anything for me. Using node version v14.21.3
on macOS 14.
Fixed for me:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
Brew install did't work for me, but after adding "node-gyp," it worked fine. (+ removed node_modules) If it still doesn't work for you, maybe you can try running "npm install" or "yarn" after downloading canvas individually.
Solved : Added "node-gyp"
"node-gyp": "^10.1.0",
Environment
"canvas": "^2.11.2"
"node": ">= v18.18.1",
Mac : M1 macOS Ventura 13.4
Fixed for me:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
Fixed for me:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
Brew install did't work for me, but after adding "node-gyp," it worked fine. (+ removed node_modules) If it still doesn't work for you, maybe you can try running "npm install" or "yarn" after downloading canvas individually.
- Solved : Added "node-gyp"
"node-gyp": "^10.1.0",
- Environment
"canvas": "^2.11.2" "node": ">= v18.18.1", Mac : M1 macOS Ventura 13.4
Tks @bora001 your solution worked for me on Windows.
Steps to Reproduce
When I run
yarn
, the error is as follows:This is the information for run
yarn why canvas
:Your Environment