0

I am following the tutorial from Truffle to create a "pet shop" contract. I can follow everything until he tells me to truffle migrate.

Here is the contract:

pragma solidity ^0.5.0;

contract Adoption{
    address[16] public adopters;

    function adopt(uint petId) public returns (uint) {
    require(petId >= 0 && petId <= 15);

    adopters[petId] = msg.sender;

    return petId;
}

function getAdopters() public view returns (address[16] memory) {
    return adopters;
}
}

The migrate #1:

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

module.exports = function(deployer) {
  deployer.deploy(Migrations);
};

The migrate #2:

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

module.exports = function(deployer) {
  deployer.deploy(Adoption);
};

truffle migrate does not do anything

The network seems to be configured right on the truffle-config file

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // for more about customizing your Truffle configuration!
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    }
  }
};

And Ganache(testing) seems to not have mined any blocks even though the network is right: enter image description here

It is weird, I haven't found anyone else with the same issue as me, any ideas?

1 Answer 1

0

Turns out I had to do sudo truffle compile After using sudo to compile truffle migrate worked as it was supposed to.

1
  • 1
    I'd suggest to fix the permissions in your project files so you can run truffle without sudo.
    – Ismael
    Feb 11, 2019 at 23:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.