3

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?

  • 1
    Have you changed the compiler version in your contracts? (Including the migration files?) – Richard Horrocks Dec 3 '18 at 16:23
  • 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 Dec 3 '18 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 Dec 5 '18 at 19:00
0

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

pragma solidity ^0.5.0;
  • 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 Jan 8 at 11:16
0

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.

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.