[Ethereum] truffle has not been deployed to detected network

testrpctruffle

Is it possible to referer to a contract that has been deployed with
Contract.new() with Contract.deployed() ?

When referencing .deployed() in my test it throws :

has not been deployed to detected network (1501794786154)

Obviously the code has been successfully deployed on the network ( in my deploy file i can get access to all the contracts address, can see the sucessfull transaction in Testrpc , etc ) .

Also the network id is the good one.

    module.exports = {
      networks: {
        development: {
          host: "localhost",
          port: 8545,
          network_id: "*" // Match any network id
        }
      }
    };

Lastly :
When i check the contract Build folder json file for the contract that is not recognized as deploy i can find :

"networks": {
    "1501794786154": {

So it is indeed deployed.

I've tried deleting the build folder and recompile again etc. as per

Truffle Webpack starts with error: MetaCoin has not been deployed to detected network

Anybody has a pointer?

Best Answer

Sometimes I've run into a similar issue where truffle doesn't detect changes in my contracts and either it doesn't compile it or, when it does, it doesn't migrate it (saying network is up to date).

You can try running truffle compile (and/or truffle migrate) with the --reset flag.

Related Topic