0

I have an issue I tried to find solution here but not solved.

I create this truffle-config file :

require('babel-register')
require('babel-polyfill')

module.exports ={
    networks:{
        development:{
            host:'127.0.0.1',
            port:'7545',
            network_id:'*'
        },
        contracts_directory:'./src/contracts/',
        contracts_build_directory:'./src/truffle_abis/',
        compilers:{
            solc:{
                version :'^0.7.0',
                optimizer:{
                    enabled:true,
                    runs : 200
                }
            }
        }
    }
}

and the Migrations contract :

pragma solidity >=0.7.0;
contract Migrations{
    address public owner;
    uint public last_completed_migration;
    constructor() {
        owner = msg.sender;
    }
    modifier restrected() {
        require(msg.sender == owner);
        _;
    }
    function setCompleted(uint completed)public restrected {
        last_completed_migration = completed;
    }
    function upgarde(address newAdress)public restrected {
        Migrations upgraded = Migrations(newAdress);
        upgraded.setCompleted(last_completed_migration);

    }
}

when I run migration truffle migrate I get error as mentioned in title of post.

the deploy script as named "1_initial_migration.sol' is like this :

const Migrations = artifacts.require('Migrations')
module.exports=function (deployer){
    deployer.deploy(Migrations)

}

I get this error as I said : Error: Could not find artifacts for Migrations from any sources

How can I solve this?

Note : I use Ganashe network

1 Answer 1

1

Those keys about location of files, contracts_directory and contracts_build_directory, should be out of networks:

module.exports ={
    contracts_directory:'./src/contracts/',
    contracts_build_directory:'./src/truffle_abis/',
    networks:{
        development:{
            host:'127.0.0.1',
            port:'7545',
            network_id:'*'
        },
        compilers:{
            solc:{
                version :'^0.7.0',
                optimizer:{
                    enabled:true,
                    runs : 200
                }
            }
        }
    }
}

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.