2016-02-27 63 views
0

我尝试使用'npm install zerorpc'在节点上安装zerorpc软件包,并且出现以下错误。该错误是因为node-gyp无法重建。node-gyp在安装节点模块时重建错误

npm http GET https://registry.npmjs.org/zerorpc 
npm http 304 https://registry.npmjs.org/zerorpc 
npm http GET https://registry.npmjs.org/underscore/1.3.3 
npm http GET https://registry.npmjs.org/node-uuid/1.3.3 
npm http GET https://registry.npmjs.org/msgpack/1.0.2 
npm http GET https://registry.npmjs.org/zmq 
npm http 304 https://registry.npmjs.org/node-uuid/1.3.3 
npm http 304 https://registry.npmjs.org/msgpack/1.0.2 
npm http 304 https://registry.npmjs.org/zmq 
npm http 304 https://registry.npmjs.org/underscore/1.3.3 
npm WARN engine [email protected]: wanted: {"node":">=0.12.7"} (current: {"node":"v0.10.25","npm":"1.3.10"}) 
npm http GET https://registry.npmjs.org/bindings 
npm http GET https://registry.npmjs.org/nan 
npm http GET https://registry.npmjs.org/nan 
npm http 304 https://registry.npmjs.org/bindings 
npm http 304 https://registry.npmjs.org/nan 
npm http 304 https://registry.npmjs.org/nan 

> [email protected] install /home/deepu/node_modules/zerorpc/node_modules/zmq 
> node-gyp rebuild 


> [email protected] install /home/deepu/node_modules/zerorpc/node_modules/msgpack 
> node-gyp rebuild 

make: Entering directory `/home/deepu/node_modules/zerorpc/node_modules/zmq/build' 
    CXX(target) Release/obj.target/zmq/binding.o 
make: Entering directory `/home/deepu/node_modules/zerorpc/node_modules/msgpack/build' 
    CC(target) Release/obj.target/libmsgpack/deps/msgpack/objectc.o 
    CC(target) Release/obj.target/libmsgpack/deps/msgpack/unpack.o 
    CC(target) Release/obj.target/libmsgpack/deps/msgpack/vrefbuffer.o 
    CC(target) Release/obj.target/libmsgpack/deps/msgpack/zone.o 
    CC(target) Release/obj.target/libmsgpack/deps/msgpack/version.o 
    AR(target) Release/obj.target/deps/msgpack/msgpack.a 
    COPY Release/msgpack.a 
    CXX(target) Release/obj.target/msgpackBinding/src/msgpack.o 
../src/msgpack.cc: In function ‘void v8_to_msgpack(v8::Handle<v8::Value>, msgpack_object*, msgpack_zone*, size_t)’: 
../src/msgpack.cc:126:93: error: could not convert ‘v8obj’ from ‘v8::Handle<v8::Value>’ to ‘v8::Local<v8::Value>’ 
     mo->via.str.size = static_cast<uint32_t>(Nan::DecodeBytes(v8obj, Nan::Encoding::UTF8)); 
                          ^
../src/msgpack.cc:129:94: error: could not convert ‘v8obj’ from ‘v8::Handle<v8::Value>’ to ‘v8::Local<v8::Value>’ 
     Nan::DecodeWrite((char*)mo->via.str.ptr, mo->via.str.size, v8obj, Nan::Encoding::UTF8); 
                          ^
../src/msgpack.cc:136:94: error: could not convert ‘result’ from ‘v8::Handle<v8::Value>’ to ‘v8::Local<v8::Value>’ 
     mo->via.str.size = static_cast<uint32_t>(Nan::DecodeBytes(result, Nan::Encoding::UTF8)); 
                          ^
../src/msgpack.cc:139:95: error: could not convert ‘result’ from ‘v8::Handle<v8::Value>’ to ‘v8::Local<v8::Value>’ 
     Nan::DecodeWrite((char*)mo->via.str.ptr, mo->via.str.size, result, Nan::Encoding::UTF8); 
                          ^
make: *** [Release/obj.target/msgpackBinding/src/msgpack.o] Error 1 
make: Leaving directory `/home/deepu/node_modules/zerorpc/node_modules/msgpack/build' 
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2 
gyp ERR! stack  at ChildProcess.onExit (/usr/share/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:797:12) 
gyp ERR! System Linux 3.16.0-60-generic 
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild" 
gyp ERR! cwd /home/deepu/node_modules/zerorpc/node_modules/msgpack 
gyp ERR! node -v v0.10.25 
gyp ERR! node-gyp -v v0.10.10 
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! weird error 1 
Assembler messages: 
Fatal error: can't create Release/obj.target/zmq/binding.o: No such file or directory 
make: *** [Release/obj.target/zmq/binding.o] Error 1 
make: Leaving directory `/home/deepu/node_modules/zerorpc/node_modules/zmq/build' 
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2 
gyp ERR! stack  at ChildProcess.onExit (/usr/share/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:797:12) 
gyp ERR! System Linux 3.16.0-60-generic 
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild" 
gyp ERR! cwd /home/deepu/node_modules/zerorpc/node_modules/zmq 
gyp ERR! node -v v0.10.25 
gyp ERR! node-gyp -v v0.10.10 
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! not ok code 0 

然后我试图通过https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version更新使用

sudo npm cache clean -f 
sudo npm install -g n 
sudo n stable 

sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/node 
给出

的版本,但我得到 '庆典:在/ usr/bin中/节点:没有这样的文件或目录' 错误

+0

。 'n'如何工作是它自动将二进制代码交换出来。这样,二进制路径从不改变。 '哪个节点'会告诉你二进制文件在哪里。很可能是'/ usr/local/bin',而不是'usr/bin'。仔细检查你的$ PATH变量,并确保/ usr/local/bin靠近前端。可能的问题是,你的$ PATH变量会在'n'换出的路径之前的某个路径上选择你的旧节点安装。 – cdbajorin

+0

我使用'sudo n 4.3.0'将其升级到4.3.0版本,然后使用'sudo npm install zerorpc'并且它工作正常! – dsl1990

回答

1

我将其升级到4.3.0版本使用

sudo npm cache clean -f 
sudo npm install -g n 
sudo n 4.3.0 

然后我用

sudo npm install zerorpc 

它工作!

至于在bash:“在/ usr/bin中/节点:没有这样的文件或目录”的错误,我用包`N`意味着你应该永远不需要符号链接做

sudo apt-get install node-legacy