window如何正确安装node-cavnas不报错

2023-04-23 11:54:53

按照下面的步骤安装canvas,一次就过了。

实在安装不成功的小伙伴,我给大家推荐另一款node平台上用的canvas,效果也不错,并且没有任何环境依赖。 @napi-rs/canvas

@napi-rs/canvas地址  https://github.com/Brooooooklyn/canvas

参考安装网址 Installation Canvas: Windows

⚠️ Be aware that according to known Chocolatey issues it is better to use instructions for manual install, provided above. If you figure out a way to fix the chocolatey instructions, feel free to edit this wiki.

All the dependencies can be installed with Chocolatey, the package manager for Windows.

  1. choco install -y python2 gtk-runtime microsoft-build-tools libjpeg-turbo (may require sudo/Administrator and reboot).

  2. 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.

  3. Run npm install canvas or yarn add canvas with command line from your project folder.


  • 2020-01-03 00:36:00

    break和continue详解for循环

    1. break:直接跳出当前循环体(while、for、do while)或程序块(switch)。其中switch case执行时,一定会先进行匹配,匹配成功返回当前case的值,再根据是否有break,判断是否继续输出,或是跳出判断(可参考switch的介绍)。 2. continue:不再执行循环体中continue语句之后的代码,直接进行下一次循环。

  • 2020-01-04 08:14:56

    input上传图片,获取图片上传尺寸

    onchange触发,获取当前file对象(这里可以获取图片的大小、类型、修改时间等) reader去读取文件 塞到页面,获取图片的宽高 移出图片节点