meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation

Home Page:http://camanjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot install CamanJS with npm

nop33 opened this issue · comments

› npm install caman

> canvas@1.6.7 install /Users/myusername/dev/project-title/dev/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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/Cellar/node/8.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/myusername/dev/project-title/dev/node_modules/canvas
gyp ERR! node -v v8.6.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN Amnestia@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@1.6.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@1.6.7 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!     /Users/myusername/.npm/_logs/2017-10-19T13_19_12_145Z-debug.log

In /Users/myusername/.npm/_logs/2017-10-19T13_19_12_145Z-debug.log:

...
400 verbose stack Error: canvas@1.6.7 install: `node-gyp rebuild`
400 verbose stack Exit status 1
400 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
400 verbose stack     at emitTwo (events.js:125:13)
400 verbose stack     at EventEmitter.emit (events.js:213:7)
400 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
400 verbose stack     at emitTwo (events.js:125:13)
400 verbose stack     at ChildProcess.emit (events.js:213:7)
400 verbose stack     at maybeClose (internal/child_process.js:927:16)
400 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
401 verbose pkgid canvas@1.6.7
402 verbose cwd /Users/myusername/dev/project-title/dev
403 verbose Darwin 16.7.0
404 verbose argv "/usr/local/Cellar/node/8.6.0/bin/node" "/usr/local/bin/npm" "install" "caman"
405 verbose node v8.6.0
406 verbose npm  v5.5.1
407 error code ELIFECYCLE
408 error errno 1
409 error canvas@1.6.7 install: `node-gyp rebuild`
409 error Exit status 1
410 error Failed at the canvas@1.6.7 install script.
410 error This is probably not a problem with npm. There is likely additional logging output above.
411 verbose exit [ 1, true ]

Version of npm:

› npm -v
5.5.1

Same with npm 4.0.5

commented

Environmental variable problem

commented

you should add the path

zhengyongxiong - can tell us in more detail!!

On server side it depends on libcairo2 library, see the answer here: https://stackoverflow.com/a/27705973/266561

You need to complete the node-canvas dependencies first then you will be able to install caman. I was able to successfully npm install caman through this approach.

  • I met same problem and solved it by Installing node-gyp & Installing GTK 2
  • you need this.node-canvas[wiki].

I'm facing the above issue, I tried everything suggested in comments and nothing seems to work. Can anyone guide me here!!