在节点中安装zmq模块时出错

时间:2014-05-28 09:54:56

标签: node.js ubuntu npm

当我尝试在节点中安装zmq软件包时,出现以下错误

npm http GET http://registry.npmjs.org.org/zmq
npm http 200 http://registry.npmjs.org.org/zmq
npm ERR! registry error parsing json

> zmq@2.1.0 preinstall /home/sabarish/Desktop/node_modules/zmq
> node-waf clean || (exit 0); node-waf configure build

Nothing to clean (project not configured)
Setting srcdir to                        : /home/sabarish/Desktop/node_modules/zmq 
Setting blddir to                        : /home/sabarish/Desktop/node_modules/zmq/build 
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 
Checking for pkg-config version >= 0.0.0 : yes 
Checking for libzmq >= 2.1.0             : yes 
Checking for library uuid                : yes 
'configure' finished successfully (0.090s)
Waf: Entering directory `/home/sabarish/Desktop/node_modules/zmq/build'
[1/2] cxx: binding.cc -> build/Release/binding_1.o
../binding.cc:114:7: error: ‘uv_poll_t’ does not name a type
../binding.cc:115:35: error: ‘uv_poll_t’ has not been declared
../binding.cc:292:27: error: variable or field ‘UV_PollCallback’ declared void
../binding.cc:292:27: error: ‘uv_poll_t’ was not declared in this scope
../binding.cc:292:38: error: ‘handle’ was not declared in this scope
../binding.cc:292:46: error: expected primary-expression before ‘int’
../binding.cc:292:58: error: expected primary-expression before ‘int’
../binding.cc: In constructor ‘zmq::Socket::Socket(zmq::Context*, int)’:
../binding.cc:304:5: error: ‘poll_handle_’ was not declared in this scope
../binding.cc:304:24: error: expected type-specifier before ‘uv_poll_t’
../binding.cc:304:24: error: expected ‘;’ before ‘uv_poll_t’
../binding.cc:308:5: error: ‘uv_os_sock_t’ was not declared in this scope
../binding.cc:308:18: error: expected ‘;’ before ‘socket’
../binding.cc:311:50: error: invalid conversion from ‘int (*)(int, int, int)throw ()’ to ‘void*’ [-fpermissive]
In file included from ../binding.cc:29:0:
/usr/local/include/zmq.h:342:16: error:   initializing argument 3 of ‘int zmq_getsockopt(void*, int, void*, size_t*)’ [-fpermissive]
../binding.cc:312:64: error: ‘uv_poll_init_socket’ was not declared in this scope
../binding.cc:313:33: error: ‘UV_READABLE’ was not declared in this scope
../binding.cc:313:69: error: ‘uv_poll_start’ was not declared in this scope
../binding.cc: In static member function ‘static v8::Handle<v8::Value> zmq::Socket::GetSockOpt(const v8::Arguments&)’:
../binding.cc:395:12: error: ‘ZMQ_HWM’ was not declared in this scope
../binding.cc:401:12: error: ‘ZMQ_SWAP’ was not declared in this scope
../binding.cc:404:12: error: ‘ZMQ_MCAST_LOOP’ was not declared in this scope
../binding.cc: In static member function ‘static v8::Handle<v8::Value> zmq::Socket::SetSockOpt(const v8::Arguments&)’:
../binding.cc:438:12: error: ‘ZMQ_HWM’ was not declared in this scope
../binding.cc:443:12: error: ‘ZMQ_SWAP’ was not declared in this scope
../binding.cc:446:12: error: ‘ZMQ_MCAST_LOOP’ was not declared in this scope
../binding.cc: In static member function ‘static v8::Handle<v8::Value> zmq::Socket::Recv(const v8::Arguments&)’:
../binding.cc:661:45: error: too few arguments to function ‘int zmq_recv(void*, void*, size_t, int)’
In file included from ../binding.cc:29:0:
/usr/local/include/zmq.h:349:16: note: declared here
../binding.cc: In static member function ‘static v8::Handle<v8::Value> zmq::Socket::Send(const v8::Arguments&)’:
../binding.cc:774:46: error: too few arguments to function ‘int zmq_send(void*, const void*, size_t, int)’
In file included from ../binding.cc:29:0:
/usr/local/include/zmq.h:348:16: note: declared here
../binding.cc: In member function ‘void zmq::Socket::Close()’:
../binding.cc:792:20: error: ‘poll_handle_’ was not declared in this scope
../binding.cc:792:32: error: ‘uv_poll_stop’ was not declared in this scope
../binding.cc: In function ‘void zmq::Initialize(v8::Handle<v8::Object>)’:
../binding.cc:844:5: error: ‘ZMQ_HWM’ was not declared in this scope
../binding.cc:845:5: error: ‘ZMQ_SWAP’ was not declared in this scope
../binding.cc:852:5: error: ‘ZMQ_MCAST_LOOP’ was not declared in this scope
Waf: Leaving directory `/home/sabarish/Desktop/node_modules/zmq/build'
Build failed:  -> task failed (err #1): 
    {task: cxx binding.cc -> binding_1.o}
npm ERR! error installing zmq@2.1.0
npm WARN This failure might be due to the use of legacy binary "node" 
npm WARN For further explanations, please read
npm WARN /usr/share/doc/nodejs/README.Debian
npm WARN 

npm ERR! zmq@2.1.0 preinstall: `node-waf clean || (exit 0); node-waf configure build`
npm ERR! `sh "-c" "node-waf clean || (exit 0); node-waf configure build"` failed with 1
npm ERR! 
npm ERR! Failed at the zmq@2.1.0 preinstall script.
npm ERR! This is most likely a problem with the zmq package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf clean || (exit 0); node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls zmq
npm ERR! There is likely additional logging output above.
npm ERR! 
npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "zmq"
npm ERR! cwd /home/sabarish/Desktop/zeromq-3.2.1
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! code ELIFECYCLE
npm ERR! message zmq@2.1.0 preinstall: `node-waf clean || (exit 0); node-waf configure build`
npm ERR! message `sh "-c" "node-waf clean || (exit 0); node-waf configure build"` failed with 1
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/sabarish/Desktop/zeromq-3.2.1/npm-debug.log
npm not ok

安装了libtool autoconf automake uuid-dev build-essential仍然得到同样的错误,也尝试将模块安装为 sudo npm install zmq --registry http://registry.npmjs.org/

2 个答案:

答案 0 :(得分:0)

您需要升级您的节点版本,因为v0.6.x不支持uv_poll *。截至本文撰写时,最新的稳定版节点为v0.10.28。

答案 1 :(得分:0)

  

将nodejs版本更新为v0.10.28   安装npm 1.4.9   使用sudo设置代理npm config set proxy http:// {Ipaddress}:port&amp; sudo npm config set https-proxy http:/ {/ Ip-address}:port   npm install --registry http://registry.npmjs.org/