解决m1的mac 无法安装 canvas 包
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