2

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 solc@0.4.17

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?

2

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
        }
    }
}

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.