How to install node-canvas on Windows


How to install node-canvas on Windows?

Step 1:
Installing node-gyp

Step 2:
Installing GTK 2:
If you use Nodejs 32bits, use this file
If you use Nodejs 64bits, use this file

Extract to: C:\GTK

Step 3:
Installing libjpeg-turbo :
If you use Nodejs 32bits, use this file
If you use Nodejs 64bits, use this file

then install to its default location (C:\libjpeg-turbo if 32bit or C:\libjpeg-turbo64 if 64bit).

Step 4:
Installing node-canvas

$ npm install -g canvas

> canvas@1.6.9 install C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas
> node-gyp rebuild


C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  Canvas.cc
  CanvasGradient.cc
  CanvasPattern.cc
  CanvasRenderingContext2d.cc
..\src\CanvasRenderingContext2d.cc(803): warning C4458: declaration of 'constructor' hides class member [C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\canvas.vcxproj]
  c:\users\administrator\appdata\roaming\npm\node_modules\canvas\src\CanvasRenderingContext2d.h(72): note: see declaration of 'Context2d::constructor' (compiling source file ..\src\CanvasRenderingContext2d.cc)
..\src\Canvas.cc(154): warning C4457: declaration of 'data' hides function parameter [C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\canvas.vcxproj]
  ..\src\Canvas.cc(150): note: see declaration of 'data'
  color.cc
  Image.cc
  ImageData.cc
  init.cc
  win_delay_load_hook.cc
     Creating library C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\canvas.lib and object C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\canvas.exp
  Generating code
  Finished generating code
  canvas.vcxproj -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\\canvas.node
  canvas.vcxproj -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\canvas.pdb (Full PDB)
  Copying C:/GTK/bin/libcairo-2.dll to C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\\libcairo-2.dll
          1 file(s) copied.
  Copying C:/GTK/bin/libfontconfig-1.dll to C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\\libfontconfig-1.dll
          1 file(s) copied.
  Copying C:/GTK/bin/libexpat-1.dll to C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\\libexpat-1.dll
          1 file(s) copied.
  Copying C:/GTK/bin/libfreetype-6.dll to C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\\libfreetype-6.dll
          1 file(s) copied.
  Copying C:/GTK/bin/libpng14-14.dll to C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\\libpng14-14.dll
          1 file(s) copied.
  Copying C:/GTK/bin/zlib1.dll to C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\\zlib1.dll
          1 file(s) copied.
  win_delay_load_hook.cc
  Generating code
  Finished generating code
  canvas-postbuild.vcxproj -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\\canvas-postbuild.node
  canvas-postbuild.vcxproj -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\canvas\build\Release\canvas-postbuild.pdb (Full PDB)
C:\Users\Administrator\AppData\Roaming\npm
`-- canvas@1.6.9
  `-- nan@2.8.0

Leave a Reply