my-archives / nchart

nChart for node.js inspired by Chart.js.
MIT License
48 stars 10 forks source link

Error installing nchart #1

Closed tciuro closed 10 years ago

tciuro commented 11 years ago

Hi,

Installing it on my Mac gives me the following error:

Macintosh:test tito$ sudo npm install -g nchart
npm http GET https://registry.npmjs.org/nchart
npm http 304 https://registry.npmjs.org/nchart
npm http GET https://registry.npmjs.org/canvas/1.0.2
npm http 304 https://registry.npmjs.org/canvas/1.0.2
npm WARN package.json application-name@0.0.1 No repository field.
npm WARN package.json application-name@0.0.1 No readme data.

> canvas@1.0.2 install /usr/local/lib/node_modules/nchart/node_modules/canvas
> node-gyp rebuild

./util/has_cairo_freetype.sh: line 4: pkg-config: command not found
gyp: Call to './util/has_cairo_freetype.sh' returned exit status 0. 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:415:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/nchart/node_modules/canvas
gyp ERR! node -v v0.10.12
gyp ERR! node-gyp -v v0.10.0
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

Any ideas? Thanks!

seangaffney commented 11 years ago

@tciuro It looks like you need to install pkg-config. It's a prerequisite for Cairo, which is a prerequisite for node-canvas, which is a prerequisite for this library. :)

For installation notes, check out the node-canvas wiki.

tciuro commented 11 years ago

Oh! I would have expected npm install to install these dependencies. Hm... I'm new to this, so I wonder:

1) shouldn't nchart be installing Cairo and node-canvas? 2) or perhaps Cairo's package.json is not properly setup and should be installing node-canvas but it's not?

What's the proper "etiquette" here? Rely on each module to do the right thing, or go ahead and install anything one's module requires? Thanks for the help!

fundon commented 11 years ago

@tciuro 1. Before, Cairo should be installed. For system-specific installation view the Wiki. 2. Installing nChart. Because, nChart dependent node-canvas, it will be auto installed node-canvas.

And thanks @seangaffney.