我想将Coinbase与Node Js集成,但我无法执行教程页上给出的代码。我的代码是Node JS和Coinbase
`var coinbase = require('coinbase');
var client = new coinbase.Client({'apiKey': mykey, 'apiSecret': mysecret});
client.getAccounts({}, function(err, accounts) {
accounts.forEach(function(acct) {
console.log('my bal: ' + acct.balance.amount + ' for ' + acct.name);
});
});`
我得到t时的以下错误:
accounts.forEach(account => { ^ typeError: Cannot read property 'forEach' of null Looking forward to your answer! Thanks!
添加'if(err){console.log(err); }'在foreach循环之前调试错误。 –
谢谢。我得到一个ReferenceError:err没有定义 – donfrigo