0

I am new to smart contract development and I am trying to deploy my first contract. When running the truffle compile for the first time I can see that a build folder was generated on my project however after running truffle migrate the artifacts are not being generated inside the build folder.

xxxs-iMac dApp % truffle compile


Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

Other threads suggest a problem with writing permission however since the folder build is being created I assume this is not the issue. This is the first time I am deploying a smart contract so I also think it maybe something on my dev setup although i have correctly installed truffle and ganache dependencies via npm.

Truffle config :

    module.exports = {
    networks: {
        development: {
            host: "127.0.0.1",
            port: 8545,
            network_id: "*", // Match any network id
        },
    },
    plugins: ["solidity-coverage"],
};

2_deploy_contracts.js file:

const Voting = artifacts.require("./Voting");

module.exports = function (deployer) {
    deployer.deploy(Voting);
};
5
  • please post the Error you got during migration! – MYANZIK shrestha Nov 19 '20 at 6:30
  • Have you modified the 2_deploy_contracts.js file? – alberto Nov 19 '20 at 9:45
  • @alberto yes I modified the 2_deploy_contracts.js file. I updated the thread above with the code. – dhequex Nov 20 '20 at 5:35
  • @MYANZIKshrestha thank you for the reply. I did not get any error during the migration. It simply returned : Compiling your contracts... =========================== > Everything is up to date, there is nothing to compile. Network up to date. No artifacts were created although the build folder was created. – dhequex Nov 20 '20 at 5:37
  • It seems your migration code was not executed. Make sure you properly imported contracts in migration and try running ‘’’truffle migrate —reset’’’ – MYANZIK shrestha Nov 20 '20 at 5:50
0

Please check your compiler version. Then make contract and compiler version the same. If you are working with react follow these steps:

  1. Check solidity smart contract version from top of your contract (eg. pragma solidity ^0.5.16)
  2. Check compiler version if it is greater or less than the contract version change the version of the compiler (from VS code, right click in the contract file and then select "change workspace compiler version)
  3. Then remove the node module from your project directory
  4. Now reinstall nodule module (npm install)
  5. Now migrate contract (truffle migrate --reset)
  6. Start the project (npm start)
1
  • This is a truffle-related issue, so probably addressed with point 5 only (no need to reinstall all modules...) – Sergi Juanati Jan 2 at 8:38

Your Answer

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

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