Fix node Geoip update fails

After a routine update of a customer’s application resulted in a broken package

npm update

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/nod
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:
gyp ERR! System Linux 2.6.32-431.1.2.0.1.el6.i686
gyp ERR! command “node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/b
gyp ERR! cwd /root/pmt/node_modules/geoip
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm ERR! geoip@0.4.12 install: `node-gyp rebuild`
npm ERR! Exit status 1

 npm ls in the folder reveals  :  UNMET DEPENDENCY geoip 0.4.x  marked in red.

npm ERR! missing: geoip@0.4.x, required by Autheticatagainstdb@
npm ERR! not ok code 0

Solution :

Quite unobviously the solution resides in python not npm!

Import package (install dependencies)

$ python -c ‘import gyp; print gyp.__file__’

/usr/lib/python2.6/site-packages/gyp/__init__.pyc

Hide the python package so it does not interfere

 mv /usr/lib/python2.6/site-packages/gyp /usr/lib/python2.6/site-packages/gyp_backup

Make sure it’s been hidden:

python -c ‘import gyp; print gyp.__file__’

Traceback (most recent call last):
File “<string>”, line 1, in <module>
ImportError: No module named gyp

Re-install the package

npm install
npm WARN package.json Autheticatagainstdb@ No repository field.
npm WARN package.json Autheticatagainstdb@ No README data
npm WARN package.json querystring@0.2.0 querystring is also the name of a node core module.
npm http GET https://registry.npmjs.org/geoip
npm http 304 https://registry.npmjs.org/geoip
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/nan

> geoip@0.4.12 install /root/pmt/node_modules/geoip
> node-gyp rebuild

make: Entering directory `/root/pmt/node_modules/geoip/build’
CC(target) Release/obj.target/geoip/deps/geoip-api-c-1.5.2/libGeoIP/GeoIP.o
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIP.c: In function ‘GeoIP_open’:
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIP.c:1077: warning: comparison between signed and unsigned integer expressions
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIP.c: In function ‘_get_name_gl’:
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIP.c:1691: warning: comparison between signed and unsigned integer expressions
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIP.c: In function ‘_get_name_v6_gl’:
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIP.c:1743: warning: comparison between signed and unsigned integer expressions
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIP.c: In function ‘GeoIP_range_by_ip_gl’:
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIP.c:1821: warning: comparison between signed and unsigned integer expressions
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIP.c:1830: warning: comparison between signed and unsigned integer expressions
CC(target) Release/obj.target/geoip/deps/geoip-api-c-1.5.2/libGeoIP/GeoIPCity.o
CC(target) Release/obj.target/geoip/deps/geoip-api-c-1.5.2/libGeoIP/GeoIPUpdate.o
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIPUpdate.c: In function ‘GeoIP_update_database’:
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIPUpdate.c:466: warning: comparison between signed and unsigned integer expressions
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIPUpdate.c: In function ‘GeoIP_update_database_general’:
../deps/geoip-api-c-1.5.2/libGeoIP/GeoIPUpdate.c:909: warning: comparison between signed and unsigned integer expressions
CC(target) Release/obj.target/geoip/deps/geoip-api-c-1.5.2/libGeoIP/base64.o
CC(target) Release/obj.target/geoip/deps/geoip-api-c-1.5.2/libGeoIP/md5.o
CC(target) Release/obj.target/geoip/deps/geoip-api-c-1.5.2/libGeoIP/timeZone.o
CC(target) Release/obj.target/geoip/deps/geoip-api-c-1.5.2/libGeoIP/regionName.o
CC(target) Release/obj.target/geoip/deps/geoip-api-c-1.5.2/libGeoIP/GeoIP_deprecated.o
AR(target) Release/obj.target/deps/geoip-api-c-1.5.2/libgeoip.a
COPY Release/libgeoip.a
CXX(target) Release/obj.target/geoip/src/global.o
CXX(target) Release/obj.target/geoip/src/init.o
CXX(target) Release/obj.target/geoip/src/country.o
../src/country.cc: In static member function ‘static v8::Handle<v8::Value> geoip::Country::close(const v8::Arguments&)’:
../src/country.cc:207: warning: no return statement in function returning non-void
CXX(target) Release/obj.target/geoip/src/country6.o
../src/country6.cc: In static member function ‘static v8::Handle<v8::Value> geoip::Country6::close(const v8::Arguments&)’:
../src/country6.cc:221: warning: no return statement in function returning non-void
CXX(target) Release/obj.target/geoip/src/city.o
../src/city.cc: In static member function ‘static v8::Handle<v8::Value> geoip::City::close(const v8::Arguments&)’:
../src/city.cc:317: warning: no return statement in function returning non-void
CXX(target) Release/obj.target/geoip/src/city6.o
../src/city6.cc: In static member function ‘static v8::Handle<v8::Value> geoip::City6::close(const v8::Arguments&)’:
../src/city6.cc:312: warning: no return statement in function returning non-void
CXX(target) Release/obj.target/geoip/src/org.o
../src/org.cc: In static member function ‘static v8::Handle<v8::Value> geoip::Org::close(const v8::Arguments&)’:
../src/org.cc:199: warning: no return statement in function returning non-void
CXX(target) Release/obj.target/geoip/src/region.o
../src/region.cc: In static member function ‘static v8::Handle<v8::Value> geoip::Region::close(const v8::Arguments&)’:
../src/region.cc:194: warning: no return statement in function returning non-void
CXX(target) Release/obj.target/geoip/src/netspeed.o
../src/netspeed.cc: In static member function ‘static v8::Handle<v8::Value> geoip::NetSpeed::close(const v8::Arguments&)’:
../src/netspeed.cc:205: warning: no return statement in function returning non-void
CXX(target) Release/obj.target/geoip/src/utils.o
SOLINK_MODULE(target) Release/obj.target/geoip.node
SOLINK_MODULE(target) Release/obj.target/geoip.node: Finished
COPY Release/geoip.node
make: Leaving directory `/root/pmt/node_modules/geoip/build’
geoip@0.4.12 node_modules/geoip
└── nan@0.5.2

npm ls shows the package is now there.

Application now runs fine !!

Hope this helps anyone.

nJoy 😉

Leave a Reply

Your email address will not be published. Required fields are marked *