I want to change solc version on my system(downgrade from 0.5.16 to 0.4.17). I tried uninstalling it with

npm -g uninstall solc

and then installed with

npm -g install [email protected]

but it does not work, "truffle version" still returns "Solidity v0.5.16 (solc-js)" when I run it from my CMD. However when I run

solcjs --version

separately, the correct version is returned - 0.4.17+commit.bdeb9e52.Emscripten.clang

How can I change solc version on my system?

1 Answer 1


Truffle installs its own internal version of solcjs.

If you're on Truffle 5.x, then you can configure it (after the installation) to use a different compiler for the various commands that it provides (truffle compile, truffle test, truffle deploy, etc).

In your Truffle configuration file (truffle.js or truffle-config.js), add this section:

compilers: {
    solc: {
        version: "0.4.17",
        optimizer: {
            enabled: true,
            runs: 200
  • Does this mean solcjs will use 0.4.17 as well as the default version? solc can be changed on the fly using $ solc-select install 0.5.0 then $ solc-select use 0.5.0. I couldn't change the version on the fly with solcjs so I just use solc --abi x.sol -o build
    – Edison
    Oct 20, 2021 at 14:18

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.