Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

node.js实战书本上的第二章“构建有多个房间的聊天室程序”,引入socket.io报错

$
0
0

源代码是:node.js实战书本上的第二章“构建有多个房间的聊天室程序”,(代码纯手动输入)

错误:在chat_server.js中添加下面这行代码会报错,但是只要注释掉这行代码就又OK了,不知道是什么鬼情况,哪位朋友知道问题的原因,还请告知,万分感谢! var socketio = require(‘socket.io’);

报错内容:

chatrooms/node_modules/socket.io/lib/store.js:35 Store.prototype.proto = EventEmitter.prototype; ^

TypeError: Cannot read property ‘prototype’ of undefined at Object.<anonymous> (/Users/abner/Documents/node/chatrooms/node_modules/socket.io/lib/store.js:35:41) at Module._compile (module.js:573:32) at Object.Module._extensions…js (module.js:582:10) at Module.load (module.js:490:32) at tryModuleLoad (module.js:449:12) at Function.Module._load (module.js:441:3) at Module.require (module.js:500:17) at require (internal/module.js:20:19) at Object.<anonymous> (/Users/abner/Documents/node/chatrooms/node_modules/socket.io/lib/manager.js:16:13) at Module._compile (module.js:573:32)

代码图片:![E74E3765-DDC5-4B5C-9381-B8E94975C26C.png](//dn-cnode.qbox.me/FurDZvpyFuot9w2KF3OsfYBIbYEc)

Viewing all articles
Browse latest Browse all 14821

Trending Articles