node-phash icon indicating copy to clipboard operation
node-phash copied to clipboard

Installation errorr on CentOS

Open marcolino opened this issue 10 years ago • 3 comments

I'm trying to install node-phash on CentOS release 6.6:

npm install phash

The errors I get:

> [email protected] install /home/test/node_modules/phash
> node-gyp rebuild

make: Entering directory `/home/test/node_modules/phash/build'
  CXX(target) Release/obj.target/pHash/phash.o
In file included from ../phash.cpp:3:
/usr/local/include/pHash.h:144: error: expected ‘;’ before ‘<’ token
/usr/local/include/pHash.h:211: error: expected ‘,’ or ‘...’ before ‘<’ token
/usr/local/include/pHash.h:250: error: expected ‘,’ or ‘...’ before ‘<’ token
/usr/local/include/pHash.h:273: error: expected ‘,’ or ‘...’ before ‘<’ token
In file included from ../phash.cpp:3:
/usr/local/include/pHash.h:292: error: expected initializer before ‘<’ token
make: *** [Release/obj.target/pHash/phash.o] Error 1
make: Leaving directory `/home/test/node_modules/phash/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 2.6.32-504.12.2.el6.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/test/node_modules/phash
gyp ERR! node -v v0.10.40
gyp ERR! node-gyp -v v1.0.1
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 phash 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 phash
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.32-504.12.2.el6.x86_64
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "phash"
npm ERR! cwd /home/test/pHash-0.9.6
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

Before installing phash, I did follow the instructions to install phash libraries (found on http://nerdanswer.com/answer.php?q=114662):

$ wget https://downloads.sourceforge.net/project/cimg/CImg-1.6.6.zip
$ unzip CImg-1.6.6.zip
$
$ wget http://phash.org/releases/pHash-0.9.6.tar.gz
$ tar xvf pHash-0.9.6.tar.gz
$
$ cp CImg-1.5.4/CImg.h pHash-0.9.6/src/
$
$ cd pHash-0.9.6
$ ./configure --enable-video-hash=no --enable-audio-hash=no
$ make
$ sudo make install

Any suggestion?

marcolino avatar Sep 15 '15 08:09 marcolino

this might be because this library needs node-gyp which in turn supports python2 and it needs GCC so if you are using centos try running yum groupinstall "Development Tools" or yum install -y gcc g++ kernel-devel for minimal dev tools.then run npm to install library in case of ubuntu try running sudo apt-get install -y build-essential before running npm.

Rafi993 avatar May 10 '16 05:05 Rafi993

Better late than never... :-) I will try your suggestion, thanks...

marcolino avatar May 10 '16 07:05 marcolino

Having similar issue.

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:./pHash-0.9.6/ node-gyp rebuild gyp info it worked if it ends with ok gyp info using [email protected] gyp info using [email protected] | linux | x64 gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp info spawn /usr/bin/python gyp info spawn args [ '/root/.nvm/versions/node/v6.10.3/lib/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/root/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/root/.nvm/versions/node/v6.10.3/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/root/.node-gyp/6.10.3/include/node/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/root/.node-gyp/6.10.3', gyp info spawn args '-Dnode_gyp_dir=/root/.nvm/versions/node/v6.10.3/lib/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=node.lib', gyp info spawn args '-Dmodule_root_dir=/root', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' ] gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR make: Entering directory /root/build' make: *** No rule to make target Release/obj.target/pHash/phash.o', needed by 'Release/obj.target/pHash.node'. Stop. make: Leaving directory /root/build' gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] gyp ERR! build error gyp ERR! stack Error: make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/root/.nvm/versions/node/v6.10.3/lib/node_modules/node-gyp/lib/build.js:285:23) 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.9.27-moby gyp ERR! command "/root/.nvm/versions/node/v6.10.3/bin/node" "/root/.nvm/versions/node/v6.10.3/bin/node-gyp" "rebuild" gyp ERR! cwd /root gyp ERR! node -v v6.10.3 gyp ERR! node-gyp -v v3.6.1 gyp ERR! not ok

leoamigood avatar May 25 '17 17:05 leoamigood