【问题标题】:error in installing hiredis through npm通过 npm 安装hiredis时出错
【发布时间】:2014-05-10 12:42:01
【问题描述】:

我正在尝试通过 npm 安装hiredis,它给出的错误为

  npm  install hiredis redis

  npm http GET https://registry.npmjs.org/redis
  npm http GET https://registry.npmjs.org/hiredis
  npm http 304 https://registry.npmjs.org/hiredis
  npm http 304 https://registry.npmjs.org/redis
  npm http GET https://registry.npmjs.org/bindings
  npm http 304 https://registry.npmjs.org/bindings

  > hiredis@0.1.16 install /home/mohit/node_modules/hiredis
  > node-gyp rebuild

  make: Entering directory `/home/mohit/node_modules/hiredis/build'
  CC(target) Release/obj.target/hiredis/deps/hiredis/hiredis.o
  CC(target) Release/obj.target/hiredis/deps/hiredis/net.o
  CC(target) Release/obj.target/hiredis/deps/hiredis/sds.o
  CC(target) Release/obj.target/hiredis/deps/hiredis/async.o
  AR(target) Release/obj.target/deps/hiredis.a
  COPY Release/hiredis.a
  CXX(target) Release/obj.target/hiredis/src/hiredis.o
  make: g++: Command not found
  make: *** [Release/obj.target/hiredis/src/hiredis.o] Error 127
  make: Leaving directory `/home/mohit/node_modules/hiredis/build'
  gyp ERR! build error 
  gyp ERR! stack Error: `make` failed with exit code: 2
  gyp ERR! stack     at ChildProcess.onExit     
  (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
  gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
  gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:807:12)
  gyp ERR! System Linux 3.2.0-23-generic
  gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-        
  gyp.js" "rebuild"
  gyp ERR! cwd /home/mohit/node_modules/hiredis
  gyp ERR! node -v v0.10.28
  gyp ERR! node-gyp -v v0.13.0
  gyp ERR! not ok 
  npm ERR! hiredis@0.1.16 install: `node-gyp rebuild`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the hiredis@0.1.16 install script.
  npm ERR! This is most likely a problem with the hiredis 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 hiredis
  npm ERR! There is likely additional logging output above.

  npm ERR! System Linux 3.2.0-23-generic
  npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "hiredis" "redis"
  npm ERR! cwd /home/mohit
  npm ERR! node -v v0.10.28
  npm ERR! npm -v 1.4.9
  npm ERR! code ELIFECYCLE
  npm ERR! 
  npm ERR! Additional logging details can be found in:
  npm ERR!     /home/mohit/npm-debug.log
  npm ERR! not ok code 0

这可能与

重复

Hiredis installing error using NPM

但这个问题没有得到回答,也不清楚

【问题讨论】:

  • 我在 zlib 上失败了..“错误:zlib._binding.onerror (zlib.js:295:17) 的标头检查不正确”

标签: node.js ubuntu-12.04 npm hiredis


【解决方案1】:

错误似乎是在寻找 c/c++ 编译器问题。

make: g++: Command not found

可能是g++没有安装或者不在make命令可以找到的路径中。

在提示符下执行“which g++”,看看它在哪里。

【讨论】:

  • 错误/输出是什么?我在mac上运行我的,我得到:/usr/bin/g++
  • 我明白了,似乎没有安装 g++,我使用 sudo apt-get install g++ 安装了它,然后再次运行 npm installhiredis redis 并且它工作了,谢谢
猜你喜欢
  • 2014-05-24
  • 2015-04-07
  • 1970-01-01
  • 2016-03-04
  • 2018-03-11
  • 2017-03-21
  • 1970-01-01
  • 1970-01-01
  • 2014-11-02
相关资源
最近更新 更多