I have made a sample contract using Truffle's pet-shop. I have also added the 2_deploy_contracts.js file.

I have changed the solidity version and also the constructor() public {} to comply with the new rules of Solidity.

My Ganache is running parallelly. But, whenever I run the command truffle migrate, it returns nothing, so I believe that the command is failing.

The smart contract being used:

pragma solidity 0.5.0;

contract Election
    string public candidate;
    string public candidate1;

    constructor () public
        candidate = "A";
        candidate1 = "B";


pragma solidity ^0.5.0;

contract Migrations {
  address public owner;
  uint public last_completed_migration;

  modifier restricted() {
    if (msg.sender == owner) _;

  constructor() public {
    owner = msg.sender;

  function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;

  function upgrade(address new_address) public restricted {
    Migrations upgraded = Migrations(new_address);

The code for 1_initial_migration:

var Migrations = artifacts.require("./Migrations.sol");

export default function(deployer) {

The code for 2_deploy_contracts.js:

var Election = artifacts.require("./Election.sol");

module.exports = function(deployer) {

I am using:

  • Truffle v5.0.4 (core: 5.0.4)
  • Solidity v0.5.0 (solc-js)
  • Node v8.12.0
  • Ganache v1.3.0
  • Please share you deployment scripts, the relevant contracts, and your environment details (ganache version, truffle version, etc). – goodvibration Feb 20 '19 at 8:59
  • @goodvibration I have edited my question to add the details. Please have a look. – Akhil Kintali Feb 20 '19 at 9:25
  • 1
    BTW, you forgot to post 1_initial_migration.js and Migrations.sol. – goodvibration Feb 20 '19 at 9:29
  • 1
    Downgrade your Truffle to the latest v4.x (i.e., v4.1.15), upgrade your Ganache to the latest version (v6.2.5 AFAIK), I think you'll find your migration working. – goodvibration Feb 20 '19 at 10:07
  • 1
    I did what you suggested. It works like magic. Thanks! – Akhil Kintali Feb 20 '19 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.