我的index.js中有代码,当我通过node index.js
运行它时Utils.getCardsInSets((ERR, DATA) => {
if (!ERR) {
allCards = DATA;
console.log("Card data loaded. [" + Object.keys(DATA).length + "]");
} else {
console.log("An error occurred while getting cards: " + ERR);
}
});
而且我有错误:
/root/cardsteambot/index.js:38
console.log("Card data loaded. [" + Object.keys(DATA).length + "]");
^
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at Utils.getCardsInSets (/root/cardsteambot/index.js:38:52)
at Request.request [as _callback] (/root/cardsteambot/utils.js:41:13)
at Request.self.callback (/root/cardsteambot/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/root/cardsteambot/node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/root/cardsteambot/node_modules/request/request.js:1085:12)
我该如何修理呢。