I have problems updating truffle. I run the command "truffle --version" and i got truffle version 4.0.1 and solc version 0.4.18. So i wanted to upgrade to 4.1.6 which is the latest version. I run "sudo npm uninstall -g truffle" and then i run the command "sudo npm install -g truffle". After that i run "truffle version" and i got again 4.0.1 and solc 0.4.18. Does anyone know why i can not update to latest version? Basically i am intrested in updating solc version to latest 0.4.22 but after some search i found out i have to update truffle in order to update solc compiler.

Fixed: After i restarted the pc, truffle was updated. Also as Med Mansour commended below maybe a restart wasn't neseccary and it was just needed to close the cmd or terminal and open a new one.

1 Answer 1


you should go to the general node_modules folder and then to the truffle folder and from there run the npm install [email protected]. that way truffle will use the new compiler even if it will not display it when running truffle --version.

It worked for me and is probably the best solution.

  • Thank you for your answer. I don't know if it works, because after i restart the pc truffle was updated. It was a stupid mistake not to think to restart the pc, but i didn't thought it was necessary.
    – kathi
    Commented Apr 18, 2018 at 14:18
  • yes it shouldn't be necessary, but maybe you just needed to close the cmd or terminal and open a new one, happened to me on windows before. Commented Apr 18, 2018 at 16:41
  • Modifying any subdependency or any code within node_module is a dirty hack and should never happen as any update of the dependencies would remove the modifications. If there's a bug due to bad dependency implementation it should be mentioned to maintainers in an issue, and if not maintained, create a fork of the dependency.
    – Asone
    Commented Dec 14, 2018 at 8:08
  • @Asone This happened due to truffle not working straight with updating solc. This answer is way old and was originally proposed to me by a contributor on the GitHub issue concerning this same issue. Commented Dec 14, 2018 at 14:52

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.