0

I've done npm install -g solc@0.4.16 and it reads solc@0.5.16 when doing the truffle version

  compilers: {
    solc: {
      version: "^0.4.26", // A version or constraint - Ex. "^0.5.0"
                         // Can also be set to "native" to use a native solc
      //docker: <boolean>, // Use a version obtained through docker
      parser: "solcjs",  // Leverages solc-js purely for speedy parsing
      //settings: {
      //  optimizer: {
      //    enabled: <boolean>,
      //    runs: <number>   // Optimize for how many times you intend to run the code
      //  },
      //  evmVersion: <string> // Default: "petersburg"
      // }
    }
  }

truble

CompileError: /C/Users/imama/Documents/token_sale/contracts/DappToken.sol:1:1: ParserError: Source file requires different compiler version (current compiler is 0.5.16+commit.9c3226ce.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.26;
^----------------------^
,/C/Users/imama/Documents/token_sale/contracts/DappTokenSale.sol:1:1: ParserError: Source file requires different compiler version (current compiler is 0.5.16+commit.9c3226ce.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.26;
^----------------------^
,/C/Users/imama/Documents/token_sale/contracts/Migrations.sol:1:1: ParserError: Source file requires different compiler version (current compiler is 0.5.16+commit.9c3226ce.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.26;
^----------------------^

enter image description here

1
  • Does it work if you comment out parser: "solcjs" line?
    – Ismael
    Oct 16 '20 at 17:14
0

Truffle now doesn't supports the solidity version below the 0.5.16. So you have to write the smart contracts which are equal or above this version

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.