0

I have completed Truffle's Pet Shop tutorial up to the point of migrating the Adoption.sol contract with 2_deploy_migration.js .

This is the error that shows up in the terminal.

Starting migrations...
======================
> Network name:    'development'
> Network id:      5777
> Block gas limit: 6721975 (0x6691b7)


2_deploy_contracts.js
=====================

Error: Migration /Users/user/pet-shop-tutorial/migrations/2_deploy_contracts.js invalid or does not take any parameters
    at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:50:1)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:217:1)
    at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
    at Object.runFrom (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:87:1)
    at runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:258:1)
    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:223:1)
    at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:172:1) Truffle v5.4.10 (core: 5.4.10) Node v14.17.6

Here is the code from 2_deploy_contracts.js

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

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

and from Adoption.sol

// SPDX-License-Identifier: MIT 
pragma solidity 0.8.7;

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 getAdopter() public view returns(address[16] memory){
        return adopters;
    }
    
    


}

What exactly is going wrong?

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.