forked from Automattic/node-canvas
-
Notifications
You must be signed in to change notification settings - Fork 0
Installation Windows
Tim Knip edited this page Sep 24, 2016
·
24 revisions
Building the node-canvas module requires:
- A global installation of node-gyp, which requires:
- Python 2.7 for Windows
- Microsoft Visual C++ 2010 or later
- GTK 2
- For optional JPEG support (pending #458): libjpeg-turbo
- Run the latest 2.7.x Python installer (
v3.x.xis not supported). - Install Visual Studio. Community and Express are both free. Community is a bigger installation but provides more features; Express is sufficient. When installing, ensure that you select the option for C++ support. You can also try the C++ Build Tools as described here.
- Install node-gyp globally with
npm install -g node-gyp.
Notes:
- We've tested Visual Studio 2010, 2013 and 2015, x86 and x64.
- Ensure the Python directory (e.g
C:\Program Files\Python) is available inPATH. - You can force gyp to use a specific edition of VS, by providing a
--msvs_version=2013hint tonpm install canvas(if you're installing from scratch) ornode-gyp rebuild(if you're building node-canvas). - If anything goes wrong, please refer to the node-gyp documentation.
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-1.4.0-vc.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
jpeg_rootandwith_jpegarguments tonpm installornode-gyp rebuild. For example:node-gyp rebuild --jpeg_root=c:\somewhere\libjpeg-turbo --with_jpeg=true.
In the root of the node-canvas module you may use node-gyp to build the native module:
node-gyp rebuild