ganache-cli problem

 

Truffle|xxx Token has not been deployed to detected network (network/artifact mismatch)

Description

I’m testing one contract today with truffle console, and at the beginning I was running truffle test to test the contract. However, for some reason, I shifted to truffle console method. And I got the error above.

Solutions on line

I looked up many solutions on line, here are my finding.

  • Network error. 127.0.0.1:8545(in my case there is nothing wrong with network) might be unavaliable.
  • Account error. The account used hasn’t been unlocked.

My solution

It turns out the problem lies in 2_deploy_migration.js: var Ether_contract = artifacts.require("xxxToken"); truffle get to this first, but by the time the token has not been deployed.