节点geoip安装失败

时间:2014-11-02 18:44:15

标签: node.js npm geoip

安装geoip包时:npm install geoip,我收到以下错误。我也尝试在ubuntu上安装nodejs-legacy软件包,但仍然有同样的错误。以前有人遇到过同样的问题吗?

gyp: Call to 'node -e "require('nan')"' returned exit status 0. 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/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.11.0-26-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/qiong/dev/startup/webrtc/sample/chatboxx/node_modules/geoip
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! geoip@0.5.5 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! 
npm ERR! Failed at the geoip@0.5.5 install script.
npm ERR! This is most likely a problem with the geoip 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 geoip
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.0-26-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "geoip"
npm ERR! cwd /home/qiong/dev/startup/webrtc/sample/chatboxx
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/qiong/dev/startup/webrtc/sample/chatboxx/npm-debug.log
npm ERR! not ok code 0

1 个答案:

答案 0 :(得分:0)

我使用了这个包 - https://www.npmjs.org/package/geoip-native,它已经很老了,但它运作正常。您也可以从maxmind下载区域的实际CSV文件。 通常,如果它说node-gyp失败,可能会有一些c ++绑定没有安装。 尝试su -c 'apt-get install build-essential'安装编译二进制模块所需的依赖项