m1 芯片不能直接 npm install canvas,会报错。

Github上的解决方案:
https://github.com/Automattic/node-canvas/issues/1733

Ok, I somehow got it to work but I really don't know what I changed... I assume you ran brew install pkg-config cairo pango libpng jpeg giflib librsvg at some point? The only thing I remember doing was running brew doctor once, then npm uninstall canvas and npm i canvas --save

1. 安装依赖

brew install pkg-config cairo pango libpng jpeg giflib librsvg 

2. 删除 node_modules 重新安装

rm -rf node_modules
npm install

标签: none

仅有一条评论

  1. [...]首先遇到的是 canvas 包装不上,最后在 Google 上找到的解决方案就是 brew install pkg-config cairo pango libpng jpeg giflib librsvg, 参考 解决m1的mac 无法安装 canvas 包[...]

添加新评论