node-imagemagick-native icon indicating copy to clipboard operation
node-imagemagick-native copied to clipboard

Ha error in linux

Open jamlfy opened this issue 9 years ago • 12 comments

> [email protected] install /home/pol/Work/node_modules/imagemagick-native
> node-gyp rebuild

/bin/sh: 1: Magick++-config: not found
gyp: Call to 'Magick++-config --ldflags --libs' returned exit status 127. 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/share/node-gyp/lib/configure.js:344:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.16.0-30-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/pol/Work/node_modules/imagemagick-native
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1

jamlfy avatar Feb 06 '15 01:02 jamlfy

Do you have the native libraries installed? It doesn't look like it...

elad avatar Feb 07 '15 09:02 elad

mm ... which are the libraries? I have ImageMagick

jamlfy avatar Feb 07 '15 17:02 jamlfy

mm ... which are the libraries? I have ImageMagick

You need the dev libraries (libmagick++-dev for Debian / Ubuntu).

TimWolla avatar Feb 07 '15 17:02 TimWolla

Same problem here (with libmagick++-dev installed) and debian x64 jessie 3.16.0-4-amd64

> [email protected] install /home/clemsos/Dev/clemsos.github.io/node_modules/imagemagick-native
> node-gyp rebuild

/bin/sh: 1: Magick++-config: not found
gyp: Call to 'Magick++-config --ldflags --libs' returned exit status 127.
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/clemsos/.nvm/v0.10.26/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.16.0-4-amd64
gyp ERR! command "node" "/home/clemsos/.nvm/v0.10.26/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/clemsos/Dev/clemsos.github.io/node_modules/imagemagick-native
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the imagemagick-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls imagemagick-native
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/home/clemsos/.nvm/v0.10.26/bin/node" "/home/clemsos/.nvm/v0.10.26/bin/npm" "install" "imagemagick-native"
npm ERR! cwd /home/clemsos/Dev/clemsos.github.io
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/clemsos/Dev/clemsos.github.io/npm-debug.log
npm ERR! not ok code 0

clemsos avatar Feb 08 '15 12:02 clemsos

On Debian Jessie, sudo apt-get install graphicsmagick-libmagick-dev-compat seems to add Magick++-config to the path, but it looks like it will just turn Magick++-config into a link to GraphicsMagick++-config. I don't know C++ really (sorry) but GraphicsMagick is different from ImageMagick so I guess it is why this doesn't work.

clemsos@clemsos:~/Dev/clemsos.github.io$ Magick++-config
Usage: GraphicsMagick++-config [--cppflags] [--cxxflags] [--exec-prefix] [--ldflags] [--libs] [--prefix] [--version]

 For example, "example.cpp" may be compiled to produce "example" as follows:

  "c++ -o example example.cpp `GraphicsMagick++-config --cppflags --cxxflags --ldflags --libs`"

Then it won't work neither

clemsos@clemsos:~/Dev/clemsos.github.io$ npm install --save imagemagick-native


> [email protected] install /home/clemsos/Dev/clemsos.github.io/node_modules/imagemagick-native
> node-gyp rebuild

Usage: GraphicsMagick++-config [--cppflags] [--cxxflags] [--exec-prefix] [--ldflags] [--libs] [--prefix] [--version]

 For example, "example.cpp" may be compiled to produce "example" as follows:

  "c++ -o example example.cpp `GraphicsMagick++-config --cppflags --cxxflags --ldflags --libs`"
gyp: Call to 'Magick++-config --cflags --cppflags' returned exit status 1.
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/clemsos/.nvm/v0.10.26/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.16.0-4-amd64
gyp ERR! command "node" "/home/clemsos/.nvm/v0.10.26/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/clemsos/Dev/clemsos.github.io/node_modules/imagemagick-native
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the imagemagick-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls imagemagick-native
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/home/clemsos/.nvm/v0.10.26/bin/node" "/home/clemsos/.nvm/v0.10.26/bin/npm" "install" "--save" "imagemagick-native"
npm ERR! cwd /home/clemsos/Dev/clemsos.github.io
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/clemsos/Dev/clemsos.github.io/npm-debug.log
npm ERR! not ok code 0

clemsos avatar Feb 08 '15 14:02 clemsos

Ok, I solved it by doing

sudo apt-get purge graphicsmagick-libmagick-dev-compat

then look for the right lib and install it

clemsos@clemsos:~$ dpkg --search Magick++-config
libmagick++-6.q16-dev:amd64: /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick++-config
clemsos@clemsos:~$ sudo apt-get install libmagick++-6.q16-dev

add to the path and reload bash

clemsos@clemsos:~$ echo "export PATH=/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" >> ~/.bashrc
clemsos@clemsos:~$ source ~/.bashrc

Now it works.

clemsos avatar Feb 08 '15 16:02 clemsos

I'm trying to get this to work on heroku. The best way would be to update this repo, but I don't feel comfortable fixing the compile step myself. Can someone help trying what @clemsos did? https://github.com/mcollina/heroku-buildpack-imagemagick see bin/compile

Edit: I found another way by using the gm module using the subClass({imageMagick: true}) option this buildpack: https://github.com/mcollina/heroku-buildpack-graphicsmagick

trueter avatar Mar 04 '15 19:03 trueter

On Ubuntu 16.04 I had to use @clemsos solution.... In my previous Ubuntu 14.04 I'm sure I got away with just using libmagick++-dev... :-/

edit: to add to this; @clemsos solution does not actually result in having :$PATH in your bash, but the echo'd version of it. I manually changed it to :$PATH again. Since I'm not that knowledgable about echoing properly into files, I cannot provide an updated version...

qrazi avatar May 11 '16 15:05 qrazi

@trueter Did you get it working on heroku?

stanleycyang avatar Feb 19 '17 06:02 stanleycyang

This is still an issue on Debian 8, might be a good idea to update the install instructions...

tmikaeld avatar Mar 28 '17 09:03 tmikaeld

How would I go about trying what @clemsos wrote with a circle.yml file for Circle ci?

timendez avatar Aug 29 '17 21:08 timendez

On Debian Jessie installing the module directly via github:elad/node-imagemagick-native (use -force if from console, without altering package.json) actually yields a proper build. The gyp binding uses pkg-config instead of Magic's config.

This fix was introduced half a year ago and the npm version is over year old now and still uses magic config. I bet the one third of the issues could be closed by now with the fix - they are all build related.

Developers: https://www.youtube.com/watch?v=ZVPolwmpOUo

Spown avatar Nov 06 '17 13:11 Spown