我正在研究一个蒸汽机器人,它一直在崩溃:
/home/ubuntu/workspace/node_modules/steam/node_modules/steam-crypto/index.js:6
var cryptedSessionKey = crypto.publicEncrypt(publicKey, sessionKey);
^
TypeError: Object #<Object> has no method 'publicEncrypt'
at Object.exports.generateSessionKey (/home/ubuntu/workspace/node_modules/steam/node_modules/steam-crypto/index.js:6:34)
at SteamClient.handlers.(anonymous function) (/home/ubuntu/workspace/node_modules/steam/lib/steam_client.js:216:44)
at SteamClient._netMsgReceived (/home/ubuntu/workspace/node_modules/steam/lib/steam_client.js:157:26)
at Connection.emit (events.js:95:17)
at Connection._readPacket (/home/ubuntu/workspace/node_modules/steam/lib/connection.js:50:8)
at Connection.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:427:10)
at emitReadable (_stream_readable.js:423:5)
at readableAddChunk (_stream_readable.js:166:9)
at Connection.Readable.push (_stream_readable.js:128:10)
在GitHub上的node-steam的README.md中,它表示仅支持NodeJS 4.1.1及更高版本。我已经在v4.1.1以及v4.2.2上进行了测试,但仍然出现此错误。我该如何解决这个问题?
编辑:还测试了Node的最新版本(v5.1.0)但没有运气。
我目前的代码与GitHub链接中的示例相同,我只更改了用于登录Steam的变量。