napa3um / node-captcha

Simple captcha for Node.JS and Express.
MIT License
135 stars 44 forks source link

Installation Failure #22

Closed bendulum closed 6 years ago

bendulum commented 6 years ago

Running npm install --save captcha yields:

> canvas@1.6.9 install /home/bendulum/Development/xxx/node_modules/canvas
> node-gyp rebuild

Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
gyp: Call to './util/has_lib.sh freetype' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/bendulum/.nvm/versions/node/v6.10.3/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.13.0-32-generic
gyp ERR! command "/home/bendulum/.nvm/versions/node/v6.10.3/bin/node" "/home/bendulum/.nvm/versions/node/v6.10.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/bendulum/Development/xxx/node_modules/canvas
gyp ERR! node -v v6.10.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN xxx No repository field.
npm WARN xxx No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@1.6.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas@1.6.9 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/bendulum/.npm/_logs/2018-02-03T18_38_55_918Z-debug.log

sudo apt-get install libcairo2-dev does not solve this issue.

I am on KDE neon 5.11 and Node v6.10.3. Any pointers?

mhdhaque commented 6 years ago

This seems to be an issue with the dependency on canvas, which itself has other dependencies, namely, cairo and pango. You'll need to install those before you try npm install captcha. I was able to do it on OSX using brew, but I imagine it's easy enough for KDE. Try the directions here and see if it doesn't resolve the issue: https://github.com/Automattic/node-canvas#installation