【发布时间】:2012-06-28 04:54:36
【问题描述】:
我是 Node.js 的新手,安装它是为了试用 DrupalChat (v7dev) 模块。我相信这个问题出在 node.js 或 express 上,因为我超出了加载聊天模块设置的阶段。尝试启动聊天服务器时遇到以下输出
Extension loaded: drupalchat_nodejs.server.extension.js
Started http server.
info - socket.io started
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'url' of undefined
at Function.handle (/usr/local/lib/node_modules/npm/node_modules/express/node_modules/connect/lib/proto.js:105:18)
at Server.app (/usr/local/lib/node_modules/npm/node_modules/express/node_modules/connect/lib/connect.js:60:31)
at Server.serverListening (/usr/local/lib/node_modules/npm/node_modules/socket.io/node_modules/policyfile/lib/server.js:136:16)
at Server.g (events.js:154:14)
at Server.emit (events.js:64:17)
at Array.1 (net.js:710:10)
at EventEmitter._tickCallback (node.js:192:40)
我记得安装 express 时,它给出了类似“.... bugs['web'] 应该是 bugs['url']”的警告(我不记得前缀)
那么服务器是否正在尝试读取(API?)变量“url”但当前是“web”?
我的所有模块都是最新的,我应该降级吗?或者有没有办法使用另一个模块来解决这个问题?
编辑: 第 201 行是最后一行 (delete authenticatedClients[authData.authToken];)... 我刚刚添加到整个函数以获得正确的上下文
var authenticateClientCallback = function (error, response, body) {
if (error) {
console.log("Error with authenticate client request:", error);
return;
}
if (response.statusCode == 404) {
if (settings.debug) {
console.log('Backend authentication url not found, full response info:', response);
}
else {
console.log('Backend authentication url not found.');
}
return;
}
var authData = false;
try {
authData = JSON.parse(body);
}
catch (exception) {
console.log('Failed to parse authentication message:', exception);
if (settings.debug) {
console.log('Failed message string: ' + body);
}
return;
}
if (!checkServiceKey(authData.serviceKey)) {
console.log('Invalid service key "', authData.serviceKey, '"');
return;
}
if (authData.nodejsValidAuthToken) {
if (settings.debug) {
console.log('Valid login for uid "', authData.uid, '"');
}
setupClientConnection(authData.clientId, authData, authData.contentTokens);
authenticatedClients[authData.authToken] = authData;
}
else {
console.log('Invalid login for uid "', authData.uid, '"');
delete authenticatedClients[authData.authToken];
}
}
【问题讨论】:
-
你能不能显示 node.js:201 或者更多。
-
我添加了它,现在我想知道它是否是 DrupalChat 配置中的非必需设置(serviceKey),开发人员可能要求但没有反映在他的代码/cmets 中跨度>
-
v7 不稳定,你可以在这里找到一些东西:drupal.org/project/issues/…
-
嘿,是的,我看过了,drupal 7 模块缺少很多文档并使用 node.js,我现在正在慢慢玩配置变量......我想我'会将该评论标记为正确...不知道在此模块的当前状态下还要花多少时间来处理此模块
-
@racar 你能暂时把这个评论作为答案吗