I am having an error with Web3. After going through all possibilities I decided to post a question hoping for someone with a solution.
The error I keep getting is:
TypeError: Cannot read property 'then' of undefined
web3.eth.getAccounts().then(accounts => {
web3.eth.getBalance(accounts[0]).then(balance => {
console.log(balance);
}
}
Note: this exact same code is running fine on two other servers. I do have the exact same versions of Truffle, React..etc as the other two.
Any solutions will be appreciated! Thanks in advance.
.then
have changed with version, you should specify your web3 version in question. – Ayushya Mar 27 '18 at 19:10