Truffle Error Migrations contract constructor expected

0 votes

I am facing error while migrating in truffle. I have mentioned my code:

My Solidity File(Migration.sol)

pragma solidity ^0.4.17;

contract Migrations {

  address public owner;

  uint public last_completed_migration;

  modifier restricted() {

    if (msg.sender == owner) _;

  }

  constructor(Migrations) 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);

    upgraded.setCompleted(last_completed_migration);

  }

}

My Migration file 1_initial_migration.js

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

module.exports = function(deployer) {

  deployer.deploy(Migrations);

};

I get this error:

Running migration: 1_initial_migration.js   Deploying Migrations...

Error encountered, bailing. Network state unknown. Review successful

transactions manually. Error: Migrations contract constructor expected

1 arguments, received 0

    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-contract/contract.js:390:1

How to solve this?

Aug 10, 2018 in Blockchain by slayer
• 29,370 points
1,561 views

1 answer to this question.

0 votes

You are not using

constructor() public {

    owner = msg.sender;

  }

Anywhere. I ran migrate after removing the above lines and it worked.

answered Aug 10, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
1 answer

Truffle tutorials "Error:recipient address is not a contract address"

It appears like you have already migrated ...READ MORE

answered Aug 8, 2018 in Blockchain by slayer
• 29,370 points
1,051 views
0 votes
1 answer
0 votes
1 answer

Not able to migrate contract in Truffle: Error: No network specified. Cannot determine current network

Make these entries in truffle.js file: module.exports = { ...READ MORE

answered Nov 30, 2018 in Blockchain by Omkar
• 69,230 points
1,094 views
0 votes
1 answer

Ethereum "truffle server" gives error: TypeError: fsevents is not a constructor

Looks like you have files missing.  Try creating project with: truffle ...READ MORE

answered Nov 30, 2018 in Blockchain by Omkar
• 69,230 points
900 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,882 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,399 views
0 votes
1 answer

How to create a Genesis Block in a Private Network?

{     "nonce": "0x0000000000000042",     "difficulty": "0x000000100",     "alloc": {     },     "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",     "coinbase": "0x0000000000000000000000000000000000000000",     "timestamp": "0x00",     "parentHash": ...READ MORE

answered Jul 12, 2018 in Blockchain by digger
• 26,740 points
1,966 views
0 votes
2 answers

Truffle migrate gives “ Error: No network specified. ”

You have to mention on which network ...READ MORE

answered Aug 13, 2018 in Blockchain by Omkar
• 69,230 points
1,618 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP