kuno / GeoIP

GeoIP binding for nodejs(>=0.10) and iojs
GNU Lesser General Public License v2.1
414 stars 129 forks source link

Error: Unable to load shared library #38

Closed gabrielpreston closed 11 years ago

gabrielpreston commented 12 years ago

I'm running into the following problem when I try to use the module.

OS: Red Hat Enterprise Linux Server release 5.3 (Tikanga) Kernel: Linux myserver 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux NPM: 1.1.16 Node: v0.6.15 GeoIP: 1.4.8

Code:

var geoip = require('geoip');

var edition = geoip.check('/home/project/GeoLiteCity.dat');

console.log(edition);

Error:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Unable to load shared library /home/project/node_modules/geoip/build/Release/geoip.node
    at Object..node (module.js:472:11)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/home/project/node_modules/geoip/index.js:4:15)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12
kuno commented 12 years ago

How do you install geoip, from npm registry or locally? And can you check it out manually that If there is actually geoip.node binary file inside your /home/project/node_modules/geoip/build/Release folder?

gabrielpreston commented 12 years ago

I installed the geoip module using 'npm install geoip'. And the geoip.node file does exist:

./node_modules/geoip/build/Release/geoip.node: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped
kuno commented 12 years ago

Maybe you should try install in a global wild:

sudo npm install geoip -g
gabrielpreston commented 12 years ago

Unfortunately I still run into the same problem:

Error: Unable to load shared library /usr/local/lib/node_modules/geoip/build/Release/geoip.node
/usr/local/lib/node_modules/geoip/build/Release/geoip.node: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped
kuno commented 12 years ago

try set NODE_PATH environment variable:

export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules/
gabrielpreston commented 12 years ago

Yeah, that is what I did in order to make use of the global geoip module since I uninstalled the local geoip module.

TechNickAI commented 12 years ago

Same exact problem on CentOS 6.2, geoip 0.4.5, node 0.6.15, GeoIP 1.4.7

TechNickAI commented 12 years ago

RESOLVED:

On Centos and [apparently] RHEL, when compiling the MaxMind db from source as recommended on the README, it places the libraries in the wrong place. I resolved this error by installing GeoIP via yum:

sudo yum install GeoIP

kuno commented 12 years ago

@gorillamania: glad to hear that. I think install geoip from your package manager is the recommended way to do so. Compiling from the source code will only be the backup choice.