My Visual Studio Code is highlighting problem with pragma statement and I have no clue how to fix this.

Error is saying:

Source file requires different compiler version (current compiler is 0.4.17+commit.bdeb9e52.Emscripten.clang 
- note that nightly builds are considered to be strictly less than the released version

I created new folder, I opened it in VSC, I created new file Function.sol, then I wrote some basic contract to start learning syntax and stuff:

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;

contract MyContract {

    function myFunction(uint id) public view returns (uint) {
        // ...
        // function body
        // ... 


And in my VSC it looks like this: enter image description here

I have similar errors with every .sol file, even in some forked projects.

I have installed globally npm install -g solcjs And my solcjs version is: 0.8.10+commit.fc410830.Emscripten.clang

How can I deal with that kind of problems?


I followed steps from: Solved: How to change Solidity linter [solc] compiler version in Visual Studio Code?

Firstly I added those two commands to my settings.json, but using my current solcjs version :

    "solidity.compileUsingRemoteVersion": "v0.8.10+commit.fc410830",
    "solidity.enableLocalNodeCompiler": false

And here the second command is disabled with: Unknown Configuration Setting enter image description here

Problem with pragma is still highlighted.

Secondly I disabled the Solidity Extended extension by beaugunderson

And now pragma statement is no longer highlighted as an error.

But whenever I change the project and start working on some lower pragma than my specified in the settings.json problem comes back.

As far as I understand the statement:

pragma solidity ^0.5.0

Is saying: "Compile this file with compiler version not lower than 0.5.0 And I have to keep the compiler version exac same as in the pragma statement to avoid this highlighting error.

Is it how it supposed to be? Or is there any solution to that?

  • Please use just Juan Blanco solidity plugin it has a nice menu to easily fix the version issue.
    – Ismael
    Nov 25, 2021 at 4:52
  • I already uninstalled the other plugin, now I have only that one by Juan Blanco. Can you please provide me some additional informations about this "menu"?
    – BlackH3art
    Nov 25, 2021 at 18:48
  • Follow the instructions from this answer ethereum.stackexchange.com/a/99311.
    – Ismael
    Nov 25, 2021 at 19:55
  • 1
    Thank you, that solved my problem.
    – BlackH3art
    Nov 28, 2021 at 16:34


Browse other questions tagged or ask your own question.