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."

5
  • Are you doing both truffle serve and opening the browser on the same machine? Sep 10, 2016 at 0:15
  • Yes, same machine :) Sep 10, 2016 at 0:26
  • What does your Truffle configuration look like? Sep 12, 2016 at 22:47
  • v2.0.0 on Ubuntu, node v5.12.0 Sep 12, 2016 at 23:18
  • Just a standard install Sep 12, 2016 at 23:19

3 Answers 3

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 and acknowledge you have read our privacy policy.

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