- Yair Mark
Today while working with some Solidity code I ran into an issue where the version of truffle I was using (the newest one as of the writing of this post) was not playing nicely with the Solidity pragmas in the file.
The easiest solution to this was just to downgrade my version of truffle to one that supports the given pragma. This seemed simple so I tried:
npm uninstall -g truffle
But when I opened up a new shell and typed
truffle I still received the command usage - it was still installed!
I did a
which truffle to see where it was installed and received the following output:
I worked out that the issue was caused by the fact that I must have installed it previously using
sudo npm install truffle. Then I installed nvm and installed it again using
npm install -g truffle.
Nvm installs global npm dependencies in a different location hence the reason why there were 2 truffle instances on my path.
sudo rm -fr /usr/bin/truffle and installed the specific version I wanted using
npm install -g [email protected]
And it worked! I had successfully downgraded to an older version of truffle and Solc.
There are solutions that suggest manually updating solc in the
truffle global install location. But that approach is very hacky and did not work for me (it spewed a bunch of errors when running a