標籤:nodejs pomelo
Pomelo
文檔:
https://github.com/NetEase/pomelo/wiki
https://github.com/NetEase/pomelo/wiki/Home-in-Chinese
Pomelo 安裝
文檔:
https://github.com/joyent/node/wiki/Installation
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#debian-and-ubuntu-based-linux-distributions
步驟:
l 安裝nodejs
# curl -sL https://deb.nodesource.com/setup | bash -
# apt-get install -y nodejs
l 檢查nodejs是否安裝成功
$ node –v
l 安裝 pomelo
方法1:使用npm(node包管理工具)全域安裝pomelo
$ npm install pomelo –g
方法2:下載原始碼安裝
$ git clone https://github.com/NetEase/pomelo.git
$ cd pomelo
$ npm install -g
備忘:
npm文檔
https://docs.npmjs.com/
安裝問題
安裝pomelo時,提示
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.10.28"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/root/.nvm/v0.10.28/lib/node_modules/pomelo/node_modules/pomelo-rpc/node_modules/toobusy/.node-gyp"
命令換成 npm install pomelo -g --unsafe-perm 就可以成功
運行到gyp http GET http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz時, 整個安裝過程會有點久,需耐心等待
Pomelo 項目
Pomelo 命令列工具:
https://github.com/NetEase/pomelo/wiki/pomelo%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8
l 建立項目
$ pomelo init ./projectname
l 安裝依賴包
$ cd projectname
$ sh npm-install.sh
l 啟動game-server
$ cd game-server
$ pomelo start
l 啟動web-server
$ cd web-server
$ node app
l 測試
啟動瀏覽器,地址:
http://hostip:3001/
l 修改伺服器IP
$ vim web-server/public/index.html
Var host = “127.0.0.1” 修改成伺服器game-server的IP地址
Linux下Pomelo環境配置