4

I just upgraded my code to Solidity 0.5 and am trying to use the truffle framework with it. I did update my code in Remix and it does seem to work.

The problem I have is that I am unable to compile my code with truffle. I get this error message:

SyntaxError: Source file requires different compiler version (current compiler is 0.4.24+commit.e67f0147.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version pragma solidity ^0.5.0;

I have reinstalled truffle, tried it with the beta version (by first running npm -g uninstall truffle and then running npm -g install truffle@beta, reinstalled solc, but nothing seems to work so far. Does anybody have any idea about what the problem could be?

3
  • 1
    Have you changed the compiler version in your contracts? (Including the migration files?) Commented Dec 3, 2018 at 16:23
  • 1
    I had to uninstall and reinstall nvm and node and then uninstalled and reinstalled truffle@beta and now it just gives me another error. Now I am getting this error though: "UnimplementedFeatureError: Encoding type "struct Locational.LocationPredicate memory" not yet implemented." which is really strange as the code works on Remix.
    – Emul
    Commented Dec 3, 2018 at 16:59
  • @Emul Your instructions can be usefull to someone else that want to use solc 0.5 with Truffle. Can you add them as an answer?
    – Ismael
    Commented Dec 5, 2018 at 19:00

2 Answers 2

1

I managed to solve this by uninstalling and reinstalling nvm and node and then uninstalling and reinstalling truffle@beta. It could be that for some reason something was installed wrong (or didn't work with a later version) therefore creating the problem.

0

Just change the Pragma. I just did it. It works fine

pragma solidity ^0.5.0;
1
  • I already did that. It was after I updated my code with the 0.5 needed updates that it still wasn't compiling. It was only by uninstalling and reinstalling a bunch of things that I managed to make it work.
    – Emul
    Commented Jan 8, 2019 at 11:16

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.