Я работаю над паровым проектом. Для этого я использую модуль node-steam. Я зациклен на входе в систему.
Я получаю это исключение, когда пытаюсь войти в аккаунт Steam с использованием node-steam.
Исключение, как следует:
Uncaught TypeError: undefined is not a function MYAPP/node_modules/adm-zip/zipFile.js:8
Module.exports /MYAPP/node_modules/adm-zip/zipFile.js:8
module.exports /MYAPP/node_modules/adm-zip/adm-zip.js:25
handlers.(anonymous function) /MYAPP/node_modules/steam/lib/steam_client.js:252
SteamClient._netMsg`enter code here`Received /MYAPP/node_modules/steam/lib/steam_client.js:157
emitOne events.js:75
emit events.js:150
Connection._readPacket /MYAPP/node_modules/steam/lib/connection.js:50
emitNone events.js:65
EMIT events.js:147
emitReadable__ _stream_readable.js:408
emitReadable _stream_readable.js:402
readableAddChunk _stream_readable.js:157
Readable.push _stream_readable.js:109
onread net.js:510
Error: Disconnected
at SteamClient._disconnected (/MYAPP/node_modules/steam/lib/steam_client.js:186:24)
at emitOne (events.js:75:13)
at Connection.emit (events.js:150:7)
at TCP.close (net.js:457:12)
Мой исходный код дополнен следующим:
var fs = require('fs');
var Steam = require('steam');
var crypto = require('crypto');
var serverlist = [] //server list here
Steam.servers = serverlist;
var steamClient = new Steam.SteamClient();
var steamUser = new Steam.SteamUser(steamClient);
steamClient.connect();
steamUser.on('updateMachineAuth', function (sentry, callback) {
console.log('writing to file sentry');
fs.writeFileSync('sentry', sentry.bytes);
callback({ sha_file: getSHA1(sentry.bytes) });
});
function getSHA1(bytes) {
var shasum = crypto.createHash('sha1');
shasum.end(bytes);
return shasum.read();
}
steamClient.on('connected', function () {
steamUser.logOn({
account_name: “XXXXXXXX”,
password: “XXXXXXXX”,
// un-comment this when providing secondary auth-code from email
auth_code: ‘XXX’,
sha_sentryfile: getSHA1(fs.readFileSync('sentry'))
});
});
steamUser.on('loggedOn', function () {
console.log('Logged in!');
});
steamClient.on('debug', function (response) {
console.log("debug: " + response);
});
steamClient.on('logOnResponse', function (response) {
console.log(">>logOnResponse");
console.log(response);
if (response.eresult == Steam.EResult.OK) {
console.log('Logged in!');
// Your code here
}
});
steamClient.on('error', function (error) {
console.log(error.stack);
alert("yes error");
});
steamClient.on('servers', function (servers) {
alert(servers);
// fs.writeFile('servers', JSON.stringify(servers));
});
steamClient.on('disconnected', function (s) {
alert(s);
});
Ниже мои установленные версии.
Версия узла: v10.8.0
Версия NPM: 6.4.1
Версия Steam: 1.4.0
ОС: Mac
Пожалуйста, помогите мне решить эту проблему.