我想让Mozilla的BrowserQuest启动并运行并遇到问题。它取决于websocket-server
节点包,不幸的是,它已被弃用并从npm库中删除。
我添加了ws
和node-websocket-server
个软件包,但它们似乎都不是现有websocket-server
调用的简单替代品。
我之前发过的一篇SO帖子说websocket-server
替换node-websocket-server
package.json
,但是在BrowserQuest代码库中现有直接调用websocket-server
。< / p>
我还尝试直接更新server/js/ws.js
文件,如下所示(添加节点到websocket-server字段):
var cls = require("./lib/class"),
url = require('url'),
wsserver = require("node-websocket-server"),
miksagoConnection = require('node-websocket-server/lib/ws/connection'),
worlizeRequest = require('websocket').request,
http = require('http'),
Utils = require('./utils'),
_ = require('underscore'),
BISON = require('bison'),
WS = {},
useBison = false;
导致以下错误:
/homenode/browserquest/BrowserQuest/server/js/map.js:15
path.exists(filepath, function(exists) {
^
TypeError: undefined is not a function
at module.exports.cls.Class.extend.init (/home/node/browserquest/BrowserQuest/server/js/map.js:15:11)
at Class (/home/node/browserquest/BrowserQuest/server/js/lib/class.js:50:23)
at module.exports.cls.Class.extend.run (/home/node/browserquest/BrowserQuest/server/js/worldserver.js:151:20)
at /homenode/browserquest/BrowserQuest/server/js/main.js:79:15
at Function._.each._.forEach (/home/node/browserquest/BrowserQuest/node_modules/underscore/underscore.js:153:9)
at main (/home/node/browserquest/BrowserQuest/server/js/main.js:77:7)
at /home/node/browserquest/BrowserQuest/server/js/main.js:134:13
at /home/node/browserquest/BrowserQuest/server/js/main.js:117:13
at fs.js:334:14
at FSReqWrap.oncomplete (fs.js:95:15)