Using Truffle and testrpc.

I am launching testrpc via testrpc --port 8545 --unlock 0

But when I run truffle migrate I get

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: authentication needed: password or unlock

My deploy script looks like

const Turnip = artifacts.require('./Turnip.sol')

module.exports = (deployer, network, accounts) => {
  const superuser = accounts[0]
  console.log('Deploying to network', network, 'from', superuser)

  deployer.then(() => {
    Turnip.new({ from: superuser })

All the docs I've read say that testrpc's default accounts ought to be unlocked unless I specify --secure, but this does not appear to be true.

How do I force a test/development account to be unlocked?

  • Any logs from testrpc? Also, was Truffle actually connecting to another node? Commented Nov 3, 2017 at 9:40
  • no logs but I quit testrpc and ran sudo lsof -i tcp:8545 and sure enough there was a docker image running an old geth node. D'oh.
    – Dave Sag
    Commented Nov 3, 2017 at 9:53

1 Answer 1


Thanks for the tip from @l-song above I worked it out. There was an old version of geth running in a Docker container that I thought I'd killed.

Running sudo lsof -i tcp:8545 showed that the port was in use by vpnkit which is a thing Docker does.

So I killed that and now truffle migrate works.

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.