在Ubuntu上安装并运行browserquest
我已经安装了node.js和必要的包来运行browserquest 。 我已经启动了浏览器服务器,它运行在端口8080上,当我到我的浏览器并键入http:// localhost:8080 /状态,我可以看到服务器正在运行,当前没有客户端连接。 我使用client / config / build_config.json文件中的configuration构build客户端
{ "host": "http://127.0.0.1", "port": 8080 }
我在bin / build.sh中构build我的客户端。 然后我运行这个命令来创buildhttp-server来提供客户端文件。
http-server path-to-client-build -p 8000
我可以通过访问http:// localhost:8000 / index.html来查看带有httpserver的索引页面,但是当我尝试连接时,它说连接到服务器后卡住了。
注意:我正在使用这个http-server托pipe客户端文件http://search.npmjs.org/#/http-server
我认为client-build在github的当前版本上有一些问题。 相反,我使用了实际的客户端文件夹。 我已经按照这些步骤来使其工作。
确保你已经安装了节点和npm。
1)从github回购获得一份副本。
git clone https://github.com/mozilla/BrowserQuest.git
2)安装服务器所需的节点包
npm install underscore log bison websocket websocket-server sanitizer memcache
3)启动服务器
node server/js/main.js
4)转到客户端目录并安装http-server模块来为客户端文件提供服务
cd client npm install -g http-server
5)编辑config_build.json-dist指向你的主机IP和端口(在我的例子中是127.0.0.1 localhost)
{ "host": "127.0.0.1", "port": 8000, "dispatcher": false }
6)将编辑后的config_build.json-dist复制到2个新文件
cp config_build.json-dist config_build.json cp config_build.json-dist config_local.json
7)将共享文件夹复制到客户端文件夹
cp -r ../shared .
8)启动http服务器来为客户端文件提供服务
http-server
而你的服务器和客户端应该正在运行。 您可以通过转到http:// ipaddress:port / status来检查服务器是否正在运行,该端口应该显示一组已连接的客户端。 如果没有一个空的数组。 而你的客户端应该在http:// ipaddress:8000 / index.html上运行
基于dirkk0的教程https://gist.github.com/2275361