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

How to install on Ubuntu 18.04

Open euglv opened this issue 6 years ago • 1 comments

I have problems with installing node-imagemagick-native on Ubuntu 18.04. I have added /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/bin-q16 to the $PATH, but when I install imagemagick-native with npm I get the following error:

> [email protected] install /home/node/panap/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 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:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.15.0-55-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/node/panap/node_modules/imagemagick-native
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
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 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!     /root/.npm/_logs/2019-09-27T13_11_43_967Z-debug.log

euglv avatar Sep 27 '19 13:09 euglv

I was just able to get it to install, here's what I had to do:

# Install the binaries
# (this is documented)
sudo apt-get install libmagick++-dev
# Make sure the compile step can find what it needs 
# (this is documented, though I had to change the command a little)
sudo ln -s $(ls /usr/lib/$(uname -p)-linux-gnu/ImageMagick-*/bin-q16/Magick++-config | head -n 1) /usr/local/bin
# I had to add the PKG_CONFIG_PATH env var manually (not documented)
# I had to install from the master branch (not documented, but is in another github issue)
PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH yarn add elad/node-imagemagick-native#master

I hope that helps

brainthinks avatar Apr 01 '21 23:04 brainthinks