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,040 points
167 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 27,620 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,040 points
157 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 29, 2018 in Blockchain by Omkar
• 65,820 points
78 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
• 65,820 points
65 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
62 views
0 votes
1 answer
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
• 27,620 points
60 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
• 65,820 points
144 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.