kuno / GeoIP

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

Can't install GeoIP through npm #15

Closed yojimbo87 closed 13 years ago

yojimbo87 commented 13 years ago

When I try to install geoip module with npm install geoip I get this:

server:/var/src# npm install geoip
npm ERR! failed to fetch http://registry.npmjs.org/geoip/-/geoip-0.4.2.tgz
npm ERR! Error: 404 { server: 'CouchDB/1.1.0 (Erlang OTP/R14B03)',
npm ERR!   date: 'Sun, 24 Jul 2011 12:01:13 GMT',
npm ERR!   'content-type': 'text/plain;charset=utf-8',
npm ERR!   'content-length': '64',
npm ERR!   'cache-control': 'must-revalidate' }
npm ERR!     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/fetch.js:108:33)
npm ERR!     at ClientRequest.g (events.js:143:14)
npm ERR!     at ClientRequest.emit (events.js:64:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1335:9)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:108:31)
npm ERR!     at Socket.ondata (http.js:1212:22)
npm ERR!     at Socket._onReadable (net.js:677:27)
npm ERR!     at IOWatcher.onReadable [as callback] (net.js:177:10)

When I try to install previous version through npm install geoip@0.4.1 I get this:

server:/var/src# npm install geoip@0.4.1

> geoip@0.4.1 preinstall /var/src/node_modules/geoip
> node-waf clean || true; node-waf configure build

Nothing to clean (project not configured)
Checking for program g++ or c++          : /usr/bin/g++
Checking for program cpp                 : /usr/bin/cpp
Checking for program ar                  : /usr/bin/ar
Checking for program ranlib              : /usr/bin/ranlib
Checking for g++                         : ok
Checking for node path                   : not found
Checking for node prefix                 : ok /usr/local
'configure' finished successfully (0.023s)
Waf: Entering directory `/var/src/node_modules/geoip/build'
[1/9] cxx: src/init.cc -> build/default/src/init_1.o
In file included from ../src/netspeed.h:12:0,
                 from ../src/init.cc:7:
../src/node_geoip.h:7:19: fatal error: GeoIP.h: No such file or directory
compilation terminated.
Waf: Leaving directory `/var/src/node_modules/geoip/build'
Build failed:  -> task failed (err #1):
        {task: cxx init.cc -> init_1.o}

Am I doing something wrong or the problem is in the npm module?

kuno commented 13 years ago

You need install geoip c library first through either the package manager of your system or building by yourself:

wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.7.tar.gz tar -xvzf GeoIP-1.4.7.tar.gz cd GeoIP-1.4.7 ./configure --prefix=/usr make sudo make install

yojimbo87 commented 13 years ago

First I tried to install geoip-bin and geoip-database packages using apt-get in Ubuntu, but it seems that it works only if I build it myself from source as you suggested. Thanks for help.

hugh commented 13 years ago

I am having the same problem even after installing the geoip c library first (I did it by building it myself via the steps suggested by kuno above).

And then I get:

npm install geoip npm ERR! failed to fetch https://registry.npmjs.org/geoip/-/geoip-0.4.3.tgz npm ERR! Error: 404 { server: 'CouchDB/1.1.0 (Erlang OTP/R14B03)', npm ERR! date: 'Wed, 03 Aug 2011 17:14:25 GMT', npm ERR! 'content-type': 'text/plain;charset=utf-8', npm ERR! 'content-length': '64', npm ERR! 'cache-control': 'must-revalidate' } npm ERR! at ClientRequest. (/usr/local/lib/node_modules/npm/lib/utils/fetch.js:108:33) npm ERR! at ClientRequest.g (events.js:143:14) npm ERR! at ClientRequest.emit (events.js:64:17) npm ERR! at HTTPParser.onIncoming (http.js:1358:9) npm ERR! at HTTPParser.onHeadersComplete (http.js:108:31) npm ERR! at CleartextStream.ondata (http.js:1232:22) npm ERR! at CleartextStream._push (tls.js:303:27) npm ERR! at SecurePair.cycle (tls.js:577:20) npm ERR! at EncryptedStream.write (tls.js:96:13) npm ERR! at Socket.ondata (stream.js:36:26) npm ERR! Report this entire log at: npm ERR! http://github.com/isaacs/npm/issues npm ERR! or email it to: npm ERR! npm-@googlegroups.com npm ERR! npm ERR! System Linux 2.6.35.11-83.9.amzn1.i686 npm ERR! command "node" "/usr/local/bin/npm" "install" "geoip" npm ERR! cwd /home/ec2-user npm ERR! node -v v0.4.11-pre npm ERR! npm -v 1.0.22 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/ec2-user/npm-debug.log npm not ok

Any other ideas on what I can try? Thanks!

-Hugh