Node.js Nodejs TypeError:无法读取未定义的属性“chId”
我有Omegle克隆聊天服务。在我的nodejs中,超过150个用户崩溃,错误为TypeError:无法读取未定义的属性'chId'Node.js Nodejs TypeError:无法读取未定义的属性“chId”,node.js,chat,Node.js,Chat,我有Omegle克隆聊天服务。在我的nodejs中,超过150个用户崩溃,错误为TypeError:无法读取未定义的属性'chId' /home/kotka/randomi.fi/beta/varaserver2/channel.js:67 f = this.channels[e].chId; ^ TypeError: Cannot read property 'chId' of undefined at Channel.joi
/home/kotka/randomi.fi/beta/varaserver2/channel.js:67
f = this.channels[e].chId;
^
TypeError: Cannot read property 'chId' of undefined
at Channel.joinChannel (/home/kotka/randomi.fi/beta/varaserver2/channel.js:67:23)
at Session.createSession (/home/kotka/randomi.fi/beta/varaserver2/session.js:21:23)
at /home/kotka/randomi.fi/beta/varaserver2/path.js:1:268
at Server.<anonymous> (/home/kotka/randomi.fi/beta/varaserver2/fu.js:43:3)
at Server.emit (events.js:70:17)
at HTTPParser.onIncoming (http.js:1610:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
at Socket.ondata (http.js:1506:22)
at TCP.onread (net.js:374:27)
问题是什么?我如何解决
这只意味着This.channels[e]未定义,并且没有chId属性。尝试用
process.on('uncaughtException', function(err) {
console.error(err.stack);
});
发布相当混乱的代码不会给你带来任何帮助