我想將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