- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.2k
 
Installation: Windows
Building the node-canvas module requires:
- A global installation of node-gyp.
 - GTK 2
 - For optional JPEG support (node-canvas 2.0 and later): libjpeg-turbo
 
Follow the instructions here: https://github.com/nodejs/node-gyp#on-windows
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.
Notes:
- Both GTK and Node.js need either be 64bit or 32bit to compile successfully.
 - Download GTK 2, not GTK 3, which is missing the required libpng. If you get linker errors you've most likely picked the wrong bundle.
 - If you use a different location than 
C:\GTK, add aGTK_Rootargument tonpm installornode-gyp rebuild. For example:node-gyp rebuild --GTK_Root=C:\somewhere\GTK. 
Download the latest libjpeg-turbo SDK for Visual C++ (currently libjpeg-turbo-2.0.0-vc.exe or libjpeg-turbo-2.0.0-vc64.exe) and install to its default location (C:\libjpeg-turbo if 32bit or C:\libjpeg-turbo64 if 64bit).
Notes:
- Both libjpeg-turbo and Node.js need either be 64bit or 32bit to compile successfully.
 - If you use a different location, add a 
jpeg_rootargument tonpm installornode-gyp rebuild. For example:node-gyp rebuild --jpeg_root=C:\somewhere\libjpeg-turbo. 
After all dependencies are setup, npm install canvas or yarn add canvas.
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 canvasoryarn add canvaswith command line from your project folder.