简体   繁体   English

无法通过npm安装nanomsg

[英]Fails to npm install nanomsg

I try to install nanomsg on a linux machine so I do 我尝试在Linux机器上安装nanomsg ,所以我这样做

npm install nanomsg --python=python2.7 npm install nanomsg --python = python2.7

I use --python=python2.7 option, because I have two different versions of python. 我使用--python=python2.7选项,因为我有两个不同版本的python。 However that command fails with this kind of error message 但是,该命令失败并出现此类错误消息

make: Entering directory `/qt_home/{my_username}/node_modules/nanomsg/build'
  CC(target) Release/obj.target/nanomsg/deps/nanomsg/src/aio/ctx.o
cc1: error: unrecognized command line option "-Wno-maybe-uninitialized"
make: *** [Release/obj.target/nanomsg/deps/nanomsg/src/aio/ctx.o] Error 1
make: Leaving directory `/qt_home/{my_username}/node_modules/nanomsg/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Linux 2.6.18-409.el5
gyp ERR! command "/usr/local/bin/node" "/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /qt_home/{my_username}/node_modules/nanomsg
gyp ERR! node -v v6.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Linux 2.6.18-409.el5
npm ERR! argv "/bin/node" "/bin/npm" "install" "nanomsg" "--python=python2.7"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! nanomsg@3.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nanomsg@3.2.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the nanomsg 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 nanomsg
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /qt_home/{my_username}/npm-debug.log

I searched about this on the internet, but couldn't find anything helpful. 我在互联网上搜索了此内容,但找不到任何有用的信息。 I have found this link so far, but it didn't help me. 到目前为止,我已经找到了此链接 ,但并没有帮助我。

My node js version is 6.2.2 and npm version is 2.14.7. 我的node js版本是6.2.2, npm版本是2.14.7。

Any ideas or suggestions? 有什么想法或建议吗?

Have you tried, using sudo for the install. 您是否尝试过使用sudo进行安装。 Sometimes it requires it for certain parts. 有时某些部分需要使用它。

sudo npm install nanomsg --python=python2.7

Also im not too familiar with Python but can you add the direct path instead of python2.7 我对Python也不太熟悉,但是可以添加直接路径而不是python2.7吗?

sudo npm install nanomsg --python=/usr/bin/python2.7

The error message 错误讯息

cc1: error: unrecognized command line option "-Wno-maybe-uninitialized" cc1:错误:无法识别的命令行选项“ -Wno-也许-未初始化”

indicate that your compiler doesnot support the option -Wno-maybe-uninitialized . 表示您的编译器不支持-Wno-maybe-uninitialized选项。

The compiler option use to build de nanomsg librairie are defined in linux.gypi . 用于构建de nanomsg librairie的编译器选项在linux.gypi中定义。

'cflags': [
'-O3', '-Wall', '-Wextra', '-Wno-sign-compare', '-Wno-strict-aliasing',
'-Wno-unused', '-Wno-char-subscripts', '-Wno-maybe-uninitialized',
'-Wno-implicit-function-declaration', '-lpthread',
],

In order to use the nanomsg configure to build it according your compiler, you could proceed like this : 为了使用nanomsg configure根据您的编译器来构建它,您可以这样进行:

git clone https://github.com/nanomsg/nanomsg
cd nanomsg
./configure
cmake .
make 
sudo make install
sudo cp /usr/local/lib/pkgconfig/naming.pc /usr/local/lib/pkgconfig/libnaming.pc 

Next you should be able to run : 接下来,您应该可以运行:

npm install nanomsg --use_system_libnanomsg=true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM