Source file requires different compiler version

I am trying to make a Voting dapp by following instructions of a website dappuniversity.com.
This is the URL for the dapp : https://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial

I have used the truffle project ( Pet Shop) to start with, used the command “truffle unbox pet-shop” .

The below image is where you can see the error on the line 1 : Source file requires different compiler version

I also tried to get the solidity version using " truffle version" command
It gave me below output -

$ truffle version
Truffle v5.1.13 (core: 5.1.13)
Solidity - 0.5.0 (solc-js)
Node v12.14.0
Web3.js v1.2.1

Note: I am using VS Code(I.D.E) with Solidity support extension by Juan Blanco

Please help me in resolving the issue.

I installed solidity compiler using “npm install -g solc@0.5.0” for my scenario, restarted the IDE and now it works!!

1 Like