Following the truffle pet shop tutorial and ran into this error when running truffle migrate:

ParsedContract.sol:3:1: ParserError: Source file requires different compiler version (current compiler is 0.5.2+commit.1df8f40c.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
contract Election {
Compilation failed. See above.
Truffle v5.0.0 (core: 5.0.0)
Node v11.2.0

when running truffle version I get:

Truffle v5.0.0 (core: 5.0.0)
Solidity v0.5.0 (solc-js)
Node v11.2.0

and in my contracts Im using:

pragma solidity ^0.4.24

Has anyone ran into this issue? Any help getting past this would be appreciated.

1 Answer 1


You are using truffle v5, by default it will use solc v0.5.0.

But you can add a configuration option to specify solc version to use.

module.exports = {
  compilers: {
    solc: {
      version: "^0.4.25"

IMHO the better option is to migrate your contracts to solc v0.5.0.

Your Answer

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

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