我在我的 node.js 安装上成功运行了 socket.io。
info - socket.io started
控制台显示它运行正常,但只要客户端(浏览器)连接:
socket = io.connect('<my host>:8000');
控制台正在踢出一个错误:
crypto.js:123
return new Hash(hash);
^
TypeError: undefined is not a function
at Object.createHash (crypto.js:123:10)
at WebSocket.onSocketConnect (/node_modules/socket.io/lib/transports/websocket/hybi-16.js:120:23)
at WebSocket.handleRequest (/node_modules/socket.io/lib/transport.js:71:10)
at WebSocket.Transport (/node_modules/socket.io/lib/transport.js:31:8)
at new WebSocket (/node_modules/socket.io/lib/transports/websocket/hybi-16.js:59:13)
at new WebSocket (/node_modules/socket.io/lib/transports/websocket.js:31:17)
at Manager.handleClient (/node_modules/socket.io/lib/manager.js:661:19)
at Manager.handleUpgrade (/node_modules/socket.io/lib/manager.js:618:8)
at Server.<anonymous> (/node_modules/socket.io/lib/manager.js:123:10)
at Server.emit (events.js:88:20)
谁能理解这可能意味着什么?
我的代码在我的本地机器上运行良好,只有将它移动到我的生产服务器时才会发生此错误。