mscdex / node-xxhash

An xxhash binding for node.js
Other
193 stars 28 forks source link

Installation fails on RHEL7 from NPM Registry, but passes when building a Git Clone #8

Closed marcellodesales closed 9 years ago

marcellodesales commented 9 years ago

The installation process of "npme" depends on this package on RHEL7...

[root@pppdc9prd8jb node-xxhash]# uname -a
Linux pppdc9prd8jb 3.10.0-229.4.2.el7.x86_64 #1 SMP Fri Apr 24 15:26:38 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@pppdc9prd8jb node-xxhash]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.1 (Maipo)

Trying to install it from npm triggers an error trying to find the module nan. See https://github.com/npm/npme-installer/issues/61

[root@pppdc9prd8jb tmp]# npm install xxhash
-
> xxhash@0.2.2 install /tmp/node_modules/xxhash
> node-gyp rebuild

module.js:340
    throw err;
          ^
Error: Cannot find module 'nan'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at [eval]:1:1
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:456:26)
    at evalScript (node.js:559:25)
    at startup (node.js:80:7)
    at node.js:929:3
gyp: Call to 'node -e "require('nan')"' returned exit status 8. 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/lib/node_modules/node-gyp/lib/configure.js:428:16)
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 3.10.0-229.4.2.el7.x86_64
gyp ERR! command "node" "/bin/node-gyp" "rebuild"
gyp ERR! cwd /tmp/node_modules/xxhash
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok 
npm ERR! Linux 3.10.0-229.4.2.el7.x86_64
npm ERR! argv "node" "/bin/npm" "install" "xxhash"
npm ERR! node v0.10.36
npm ERR! npm  v2.11.0
npm ERR! code ELIFECYCLE

npm ERR! xxhash@0.2.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the xxhash@0.2.2 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the xxhash 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 xxhash
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/npm-debug.log

However, when I clone and build, everything works fine...

[root@pppdc9prd8jb tmp]# git clone https://github.com/mscdex/node-xxhash.git
{ "name": "xxhash",
Cloning into 'node-xxhash'...
remote: Counting objects: 101, done.
remote: Total 101 (delta 0), reused 0 (delta 0), pack-reused 101
Receiving objects: 100% (101/101), 32.16 KiB | 0 bytes/s, done.
Resolving deltas: 100% (43/43), done.

[root@pppdc9prd8jb node-xxhash]# npm install
npm WARN package.json xxhash@0.2.2 No license field.
npm WARN cannot run in wd xxhash@0.2.2 node-gyp rebuild (wd=/tmp/node-xxhash)
nan@1.8.4 node_modules/nan

readable-stream@1.0.33 node_modules/readable-stream
├── isarray@0.0.1
├── inherits@2.0.1
├── string_decoder@0.10.31
└── core-util-is@1.0.1
[root@pppdc9prd8jb node-xxhash]# vim package.json 
[root@pppdc9prd8jb node-xxhash]# rm -rf node_modules/
[root@pppdc9prd8jb node-xxhash]# npm install
npm WARN package.json xxhash@0.2.2 No license field.
npm WARN cannot run in wd xxhash@0.2.2 node-gyp rebuild (wd=/tmp/node-xxhash)
nan@1.8.4 node_modules/nan

readable-stream@1.0.33 node_modules/readable-stream
├── inherits@2.0.1
├── isarray@0.0.1
├── string_decoder@0.10.31
└── core-util-is@1.0.1

I even tried to call the node-gyp and it works as expected...

[root@pppdc9prd8jb node-xxhash]# node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@0.10.6
gyp info using node@0.10.36 | linux | x64
gyp info spawn python
gyp info spawn args [ '/usr/bin/gyp',
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   '/tmp/node-xxhash/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon-rpm.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/share/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/usr/share/node',
gyp info spawn args   '-Dmodule_root_dir=/tmp/node-xxhash',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/tmp/node-xxhash/build'
  CXX(target) Release/obj.target/hash/src/hash.o
  CC(target) Release/obj.target/hash/deps/xxhash/xxhash.o
  SOLINK_MODULE(target) Release/obj.target/hash.node
  SOLINK_MODULE(target) Release/obj.target/hash.node: Finished
  COPY Release/hash.node
make: Leaving directory `/tmp/node-xxhash/build'
gyp info ok 

Could you please help!!!?!?! thanks Marcello

marcellodesales commented 9 years ago

Just as a second note... The installation works properly on Ubuntu

mdesales@ubuntu [05/30/201511:42:56] /tmp $ uname -a
Linux ubuntu 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
mdesales@ubuntu [05/29/201518:13:40] /tmp $ npm install xxhash
/
> xxhash@0.2.2 install /tmp/node_modules/xxhash
> node-gyp rebuild

make: Entering directory `/tmp/node_modules/xxhash/build'
  CXX(target) Release/obj.target/hash/src/hash.o
  CC(target) Release/obj.target/hash/deps/xxhash/xxhash.o
  SOLINK_MODULE(target) Release/obj.target/hash.node
  SOLINK_MODULE(target) Release/obj.target/hash.node: Finished
  COPY Release/hash.node
make: Leaving directory `/tmp/node_modules/xxhash/build'
xxhash@0.2.2 node_modules/xxhash
├── nan@1.8.4
└── readable-stream@1.0.33 (inherits@2.0.1, isarray@0.0.1, string_decoder@0.10.31, core-util-is@1.0.1)
mscdex commented 9 years ago

It looks like this is an npm Enterprise issue that has to do with wrong permissions based on your linked issue. It looks like npm tries to install to a totally different directory in that case and I'm guessing that the appropriate symlink isn't created inside node_modules so that require('nan') works.

So you might check that root has the appropriate permissions to /root/.node-gyp/0.10.36.

marcellodesales commented 9 years ago

Hi @mscdex

Wait... Even if I'm installing in a different directory???

The node-gyp has permission for the root user set...

[root@pppdc9prd8jb npme-installer]# ls -la ~/.node-gyp/0.10.36/
total 0
drwx------. 2 root root  6 May 30 02:24 .
drwx------. 3 root root 20 May 30 02:24 ..

I will try to add permissions to the group and others...

marcellodesales commented 9 years ago

Hi @mscdex

I think it has to do with installing your module using the root user... I can install your module using another user other than root... Could you verify?

[mdesales@pppdc9prd8jb ~]$ npm install xxhash
-
> xxhash@0.2.2 install /export/home/mdesales/node_modules/xxhash
> node-gyp rebuild

make: Entering directory `/export/home/mdesales/node_modules/xxhash/build'
  CXX(target) Release/obj.target/hash/src/hash.o
  CC(target) Release/obj.target/hash/deps/xxhash/xxhash.o
  SOLINK_MODULE(target) Release/obj.target/hash.node
  SOLINK_MODULE(target) Release/obj.target/hash.node: Finished
  COPY Release/hash.node
make: Leaving directory `/export/home/mdesales/node_modules/xxhash/build'
xxhash@0.2.2 node_modules/xxhash
├── nan@1.8.4
└── readable-stream@1.0.33 (isarray@0.0.1, inherits@2.0.1, string_decoder@0.10.31, core-util-is@1.0.1)
mscdex commented 9 years ago

@marcellodesales Does root also have the right permissions on the parent directories too?

Unfortunately I do not have a RHEL7 setup nor do I install modules as root (the thought makes me cringe).

marcellodesales commented 9 years ago

Yeah I agree... I'm just lazy to get it done with the proper non-root user... I just want to understand why it fails with the root user...

mscdex commented 9 years ago

I really don't know, I'm just guessing. The npm team would be able to help you more with this than I could though.