按照下面的步骤安装canvas,一次就过了。
实在安装不成功的小伙伴,我给大家推荐另一款node平台上用的canvas,效果也不错,并且没有任何环境依赖。 @napi-rs/canvas
@napi-rs/canvas地址 https://github.com/Brooooooklyn/canvas
参考安装网址 Installation Canvas: Windows
All the dependencies can be installed with Chocolatey, the package manager for Windows.
choco install -y python2 gtk-runtime microsoft-build-tools libjpeg-turbo
(may require sudo/Administrator and reboot).You will need the cairo library which is bundled in GTK. Download the GTK 2 bundle for Win32 or Win64. Unzip the contents in
C:\GTK
.Run
npm install canvas
oryarn add canvas
with command line from your project folder.