Closed jimtang9527 closed 9 years ago
我在centos上面用node v0.12.1 安装一切正常。
➜ /tmp npm --registry=http://r.cnpmjs.org install nodejieba
npm WARN engine nodejieba@1.0.0: wanted: {"node":"0.10.x"} (current: {"node":"0.12.1","npm":"2.5.1"})
> nodejieba@1.0.0 install /tmp/node_modules/nodejieba
> node-gyp rebuild
child_process: customFds option is deprecated, use stdio instead.
make: Entering directory `/tmp/node_modules/nodejieba/build'
CXX(target) Release/obj.target/nodejieba/lib/index.o
CXX(target) Release/obj.target/nodejieba/lib/nodejieba.o
SOLINK_MODULE(target) Release/obj.target/nodejieba.node
SOLINK_MODULE(target) Release/obj.target/nodejieba.node: Finished
COPY Release/nodejieba.node
make: Leaving directory `/tmp/node_modules/nodejieba/build'
nodejieba@1.0.0 node_modules/nodejieba
看来应该是和 iojs 2.2.1 这个版本有关。我稍后安装一下 iojs 2.2.1 试试把。
实际上我在 node@2.2.1 上执行也是可以成功的。
不过无论如何,我还是升级了 pinyin 对 jieba 的依赖。另外后续再考虑升级到 nodejieba@1.0
@hotoo 谢谢回复。不过我想问一下你是在centos 6.5 + iojs v2.2.1 上面使用的 nodejieba 1.0.0 吗? 我刚才在 centos 6.5 + iojs v2.2.1 上试了一下,使用 nodejieba 1.0.0 确实有问题。是C++类型转换的问题。我马上修复一下。
@MiniYun 你试试 npm install nodejieba@1.0.1 这个版本,这个编译错误在这个版本修复好了。
@hotoo 不如我直接给你提交一个升级到 nodejieba@v1.0.1 的 pull request ,你觉得怎样? https://github.com/hotoo/pinyin/pull/42
merged
感谢,已经解决了。
[root@pan miniyunjs]# npm --registry=http://r.cnpmjs.org install nodejieba npm WARN engine nodejieba@1.0.0: wanted: {"node":"0.10.x"} (current: {"node":"2.2.1","npm":"2.11.0"}) / nodejieba@1.0.0 install /home/data/miniyunjs/node_modules/nodejieba node-gyp rebuild
make: Entering directory
/home/data/miniyunjs/node_modules/nodejieba/build' CXX(target) Release/obj.target/nodejieba/lib/index.o In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algobase.h:66, from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/char_traits.h:41, from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/string:42, from ../node_modules/nan/nan.h:37, from ../lib/utils.h:6, from ../lib/nodejieba.h:4, from ../lib/index.cpp:1: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_pair.h: In constructor ‘std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = size_t&, _U2 = long int, _T1 = long unsigned int, _T2 = const CppJieba::DictUnit*]’: ../lib/CppJieba/Trie.hpp:101: instantiated from here /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_pair.h:90: 错误:从类型‘long int’到类型‘const CppJieba::DictUnit*’的转换无效 make: *** [Release/obj.target/nodejieba/lib/index.o] 错误 1 make: Leaving directory
/home/data/miniyunjs/node_modules/nodejieba/build' gyp ERR! build error gyp ERR! stack Error:make
failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/data/iojs-v2.2.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:199:12) gyp ERR! System Linux 2.6.32-504.16.2.el6.x86_64 gyp ERR! command "/home/data/iojs-v2.2.1-linux-x64/bin/iojs" "/home/data/iojs-v2.2.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/data/miniyunjs/node_modules/nodejieba gyp ERR! node -v v2.2.1 gyp ERR! node-gyp -v v1.0.3 gyp ERR! not ok npm ERR! Linux 2.6.32-504.16.2.el6.x86_64 npm ERR! argv "/home/data/iojs-v2.2.1-linux-x64/bin/iojs" "/usr/local/bin/npm" "--registry=http://r.cnpmjs.org" "install" "nodejieba" npm ERR! node v2.2.1 npm ERR! npm v2.11.0 npm ERR! code ELIFECYCLEnpm ERR! nodejieba@1.0.0 install:
node-gyp rebuild
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the nodejieba@1.0.0 install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the nodejieba 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 nodejieba npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! /home/data/miniyunjs/npm-debug.log