节点geoip安装失败
Posted
技术标签:
【中文标题】节点geoip安装失败【英文标题】:node geoip installation fail 【发布时间】:2014-11-02 18:44:15 【问题描述】:安装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
【问题讨论】:
第一行说运行'node -e“require('nan')'失败。当我在我的ubuntu上尝试时,我得到:错误:找不到模块'nan'..你能只是缺少“nan”依赖项,不管那是什么? 【参考方案1】:我使用了这个包 - https://www.npmjs.org/package/geoip-native,它已经很老了,但它工作正常。您也可以从 maxmind 下载区域的实际 CSV 文件。
通常如果它说 node-gyp 失败,可能有一些 c++ 绑定没有安装。
尝试su -c 'apt-get install build-essential'
安装编译二进制模块所需的依赖项
【讨论】:
以上是关于节点geoip安装失败的主要内容,如果未能解决你的问题,请参考以下文章