Solvednode canvas canvas installation issue

Hey guys,

I am facing canvas installation issues. I installed node.js+cairo sucessfully but canvas installation is giving me this error on centos 6.7

npm http GET
npm http 304
npm http GET
npm http 304

> canvas@1.3.9 install /home/Monaba/node_modules/canvas
> node-gyp rebuild

make: Entering directory `/home/Monaba/node_modules/canvas/build'
  SOLINK_MODULE(target) Release/
  SOLINK_MODULE(target) Release/ Finished
  COPY Release/canvas-postbuild.node
  CXX(target) Release/
In file included from ../src/Canvas.h:22,
                 from ../src/
../node_modules/nan/nan.h:328: error: \u2018REPLACE_INVALID_UTF8\u2019 is not a member of \u2018v8::String\u2019
In file included from ../src/
../src/PNG.h: In function \u2018cairo_status_t canvas_write_png(cairo_surface_t*, void (*)(png_struct*, png_byte*, png_size_t), void*)\u2019:
../src/PNG.h:165: warning: case label value is less than minimum value for type
make: *** [Release/] Error 1
make: Leaving directory `/home/Monaba/node_modules/canvas/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 2.6.32-431.29.2.el6.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/Monaba/node_modules/canvas
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0
37 Answers

✔️Accepted Answer

@ibnibraahim You need to install pkg-config. brew install pkg-config

edit: Actually, if you read the readme you'll see this command under Installation, run it: brew install pkg-config cairo libpng jpeg giflib

Other Answers:

Thanks @LinusU, running brew install pkg-config cairo libpng jpeg giflib before npm install caman fixed the node-gyp error

thanks @LinusU canvas installed now.
after installation pkg-config i was facing another problem

Perhaps you should add the directory containing fontconfig.pc to the PKG_CONFIG_PATH environment variable Package 'fontconfig', required by 'cairo', not found

but after running this command every error gone
PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/ npm install canvas