搞了很久,结果比较简单
基本条件
1.gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)
https://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
export CC=/opt/rh/devtoolset-2/root/usr/bin/gcc
export CXX=/opt/rh/devtoolset-2/root/usr/bin/c++
export CPP=/opt/rh/devtoolset-2/root/usr/bin/cpp
scl enable devtoolset-2
2.npm
http://www.cnblogs.com/vurtne-lu/p/7693364.html
node-v6.11.4-linux-x64.tar.xz
vim ~/.bash_profile
export PATH=$PATH:/usr/local/product/node-v6.11.4/bin
export NODE_PATH=/usr/local/product/node-v6.11.4:/usr/local/product/node-v6.11.4/lib/node_modules
node -v
v6.11.4
npm -v
3.10.10
3.git clone node-zk-browser-master
cd node-zk-browser-master
cat package.json
{
"name": "node-zk-browser",
"version": "0.0.2",
"dependencies": {
"ejs": ">= 0.7.2",
"express": "3.x",
"zookeeper":">=3.4.9",
"express-namespace":">=0.1.1"
}
}
把 "zookeeper":">=3.4.1-4" 改成3.4.9
4.npm install zookeeper git地址https://github.com/yfinkelstein/node-zookeeper
5.开始安装
cd node-zk-browser-master
npm install -d ejs
npm install -d [email protected]
npm install -d express-namespace
npm install -d zookeeper
6.cd /usr/local/product/node-zk-browser-master/node_modules/zookeeper
看看真正跑的东西
cat binding.gyp
{
'variables': {
'platform': '<(OS)',
},
"targets": [{
"target_name": "zookeeper",
'dependencies': ['libzk'],
"sources": ["src/node-zk.cpp"],
'cflags': ['-Wall', '-O0'],
'conditions': [
['OS=="solaris"', {
'cflags': ['-Wno-strict-aliasing'],
'defines': ['_POSIX_PTHREAD_SEMANTICS'],
'include_dirs': [
'/opt/local/include/zookeeper',
'
],
'ldflags': ['-lzookeeper_st'],
}],
['OS=="mac"',{
'include_dirs': [
'<(module_root_dir)/deps/zookeeper/src/c/include',
'<(module_root_dir)/deps/zookeeper/src/c/generated',
'
],
'libraries': ['<(module_root_dir)/deps/zookeeper/src/c/.libs/libzookeeper_st.a'],
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'MACOSX_DEPLOYMENT_TARGET': '10.5'
}
}],['OS=="linux"',{
'include_dirs': [
'<(module_root_dir)/deps/zookeeper/src/c/include',
'<(module_root_dir)/deps/zookeeper/src/c/generated',
'
],
'libraries': ['<(module_root_dir)/deps/zookeeper/src/c/.libs/libzookeeper_st.a'],
}]
]},
{
'target_name': 'libzk',
'type': 'none',
'actions': [{
'action_name': 'build_zk_client_lib',
'inputs': [''],
'outputs': [''],
'action': ['sh', 'scripts/build.sh']
}]
},
{
"target_name": "after_build",
"type": "none",
"dependencies": ["zookeeper"],
"actions": [{
"action_name": "symlink",
"inputs": ["<@(PRODUCT_DIR)/zookeeper.node"],
"outputs": ["<(module_root_dir)/build/zookeeper.node"],
"action": ["sh", "scripts/symlink.sh", "<@(_inputs)"]
}]
}],
}
只有build了,才会出现zookeeper.node
Makefile after_build.target.mk config.gypi zookeeper.node
Release binding.Makefile libzk.target.mk zookeeper.target.mk
没有zookeeper.node,等下启动脚本的时候,会报错,配置里面还是引用这个东西。
7.启动就不说了
看了效果,比dubbo-admin稍微差点。瞎折腾。
排错,记得看issue。这是别人2011写的项目。