3

I'm running testrpc on the default port 8545.

I run truffle console and test with: web3.eth.sign(web3.eth.accounts[0], web3.sha3("123"))

This works fine. According to docs the sign method only works if the account is unlocked, so it seems I should be all set.

But after successfully running init/compile/migrate, I run truffle serve and when I go to the web page on localhost:8080, I get this popup message:

"Couldn't get any accounts! Make sure your Ethereum client is configured correctly."

  • Are you doing both truffle serve and opening the browser on the same machine? – Xavier Leprêtre B9lab Sep 10 '16 at 0:15
  • Yes, same machine :) – Dennis Peterson Sep 10 '16 at 0:26
  • What does your Truffle configuration look like? – Tim Coulter Sep 12 '16 at 22:47
  • v2.0.0 on Ubuntu, node v5.12.0 – Dennis Peterson Sep 12 '16 at 23:18
  • Just a standard install – Dennis Peterson Sep 12 '16 at 23:19
3

I got this error as well.

I had MetaMask Ethereum client installed but had not logged in yet.

The default truffle app.js picked up the web3 instance injected by MetaMask. Once I logged into MetaMask to create initial accounts, the error went away.

0

If Metamask plugin added to your chrome and you are using chrome then your code uses Web3 instance injected in Metamask. Once you login/unlock the Metamask then your code will get account address which created by Metamask.If you need TestRPC's default account address i.e account[0] then try with other browser.

0

I got this error too and the solution was a variation of @modpy 's one.

So I had tried to upgrade the MetaMask Chrome plugin and it was in the process of doing that - So MetaMask was enabled and was trying to connect to the local blockchain on port 8545.

Removing MetaMask from Chrome did the trick (and later I re-installed the upgraded version)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.