1

I updated to the latest version of Truffle using:

npm uninstall -g truffle

followed by:

npm install -g truffle

I verified this succeeded by doing:

truffle --version

and got this:

enter image description here

You can clearly see that I'm on version 5.0.3

I read that updating Truffle would pretty much also automatically update the Solidity compiler.

but when I do:

solc --version

I get this:

enter image description here

So its still on version 0.4.24

So I did again.
And again.
And its not working.

I've done it globally - and I've done it locally, meaning in my specific project's Directory.

Nothing works.

I tried doing it directly, by uninstalling Solidity - like this:

npm uninstall solc -g

-then reinstalling it using:

npm install solc -g

I've done pretty much everything I can think of, but its still telling me that I'm on version 0.4.24.

What's going on? What am I missing here?

========================================================

UPDATE:

I added the following to my truffle.js file:

compilers: {
    solc: {
        version: "0.5.0"  // ex:  "0.4.20". (Default: Truffle's installed solc)
    }
}

That's obviously supposed to force the use of that particular version of the compiler.

I recompiled and redeployed to ropsten - and that all worked.

So at this point, I'm assuming that the project is being compiled using v 0.5.0 of Solidity - but is it?

Here's my big question right now: how can I tell - like during run time, what compiler version is actually being used on my project at any given time? Cause at this point, I'm still getting errors in my DApp - the HTML & JS files that are querying the contract I deployed - that seem to do with the compiler+solidity versions - which was the reason I updated truffle to version 5 in the first place, to solve these issued. (But that's another matter. One thing at a time.)

===========================================================================

UPDATE#2

This shows everything:

enter image description here

-I'm installing solc v. 0.5.3 directly into my project's folder (I've already done the Global install several times.)

-I get 2 warnings - I don't know what they mean - but it says it installed 14 packages from 5 contributors, which sounds pretty good.

-but then when I do solc version, it tells me I'm on version 0.4.24

I've literally spent all day trying to resolve this.

  • What does truffle version returns? (without the dashes). In truffle v5 you can configure a version of solc in you configuration it will download and use that version. – Ismael Feb 2 at 18:03
  • wooow. truffle version returns: Truffle v5.0.3 (core: 5.0.3) Solidity v0.5.0 (solc-js) Node v8.9.4 – Sirab33 Feb 2 at 18:19
  • @Ismael I made some changes - and updated my question up to. Please check it out and let me know your thoughts. Thank you! – Sirab33 Feb 2 at 18:58
  • You can always force installation of a specific version, to install 0.5.3 you use npm install -g solc@0.5.3. Truffle do not use the global version installed instead it downloads its own copy so it is easier to switch versions. – Ismael Feb 2 at 20:20
  • OK, I think I have that part solved - meaning I've installed the latest version of truffle, but again: how do I know what particular version of the Compiler is running and being used on my project at any given point? Y'know, just to make sure that what I specified and asked for in my json.package is actually being applied? – Sirab33 Feb 2 at 20:24

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.