node.js + express error:无法读取未定义的属性'url'

时间:2012-04-16 14:49:33

标签: node.js express

我是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)

我记得当快递安装时,它发出警告,如“.... bugs ['web']应该是bug ['url']”(我记不起前缀)

服务器是否正在尝试读取(API?)变量'url'但其当前的'web'?

我所有的模块都是最新的,是否应该降级?或者有没有办法使用另一个模块解决这个问题?

编辑: 第201行是最后一行(删除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];
  }
}

4 个答案:

答案 0 :(得分:1)

Per @ thesnufkin的帖子,看起来当前拉动的底层快递版本不稳定。回到2.5.9你应该好好去:

npm卸载快递 npm install express@2.5.9

答案 1 :(得分:0)

根据要求,

drupal的v7聊天模块不稳定。你不应该在生产中使用它。

检查错误:http://drupal.org/project/issues/drupalchat?status=All&categories=All

检查论坛:http://drupalchat7.botskool.co.in/?q=forum

仍在寻找新的维护者: “新维护者想要 - 如果你有兴趣请点击beejeebus!”。

答案 2 :(得分:0)

nodejs模块有这个问题,所以我不认为它与drupalchat服务器有关。这是问题所在:http://drupal.org/node/1537702

答案 3 :(得分:0)

目前正在开发在DrupalChat中使用node.js作为后端的选项。它还取决于您下载DrupalChat的时间(因为每天更新开发代码,如果新代码已提交)。

请在此链接提出相同问题 - http://drupal.org/project/issues/drupalchat?status=All&categories=All

谢谢,

darklrd