1
votes

I am trying to deploy my contract to ganache to test my contract but am getting errors.

when I run

truffle migrate --network development --reset

I receive

Compiling your contracts...

Everything is up to date, there is nothing to compile.

but when i look at Ganache it says there are no contracts

and when i run truffle test i get

Error: SimpleStorage has not been deployed to detected network (network/artifact mismatch)

my truffle-config.js

const path = require("path");

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  contracts_build_directory: path.join(__dirname, "client/src/contracts"),
  networks: {
    development: {
      host: '127.0.0.1',
      port: 7545,
      network_id: "5337"
    },
  }
};

and my migration file

var Migrations = artifacts.require("Migrations");
var SimpleStorage = artifacts.require("SimpleStorage");

module.exports = function(deployer) {
  deployer.deploy(Migrations)
  deployer.link(Migrations, SimpleStorage)
  deployer.deploy(SimpleStorage)
} as Truffle.Migration;

export {};

honestly i just want to do write some tests and have no idea what i'm doing wrong

1

1 Answers

0
votes

Looks like you did not add your current project to ganache.

When you create a new workplace on ganache, you have two options:

enter image description here

Clic on "Add project" and go to directory of the truffle.config.js. Make sure you choose truffle.config.js

    /home/Documents/ethereum/storageProject/truffle-config.js

Restart ganache, then migrate your project again and you will see the migrations on ganache under Contracts tab