[Ethereum] Error: Truffle is currently using solc 0.5.8,

truffletruffle-contracttruffle-deploymenttruffle-migration

I run migrate in the terminal, but it shows

Error: Truffle is currently using solc 0.5.8, but one or more of your contracts specify "pragma solidity ^0.4.27".

Please update your truffle config or pragma statement(s).

enter image description here

When I follow the error and update config it doesn't work.
What should I do? Thanks.

Best Answer

Inside of the truffle-config.js you can update the solc version like so:

compilers: {
  solc: {
    version: "^0.8.0"
  }
}

Here is a full example:

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*" // Match any network id
    }
  },
  compilers: {
    solc: {
      version: "^0.8.0"
    }
  }
};
Related Topic