user16137842
user16137842

Reputation:

Cant compile solidity files using correct Solc version

when I try to run my contracts by using:

truffle migrate --network infura

I get thrown an error saying all my files require a higher pragma solidity version, in the error it says I'm currently using solc 0.5.16 yet I've ran

npm uninstall

and then

install

and when I run

NPM list or solcjs --version

it shows [email protected], could anyone help me identify the issue thanks.

Upvotes: 0

Views: 1422

Answers (1)

user16137842
user16137842

Reputation:

For some reason visual code choose a different solc compiler than the one i installed so when you run a solidity you have to use

solcjs --bin --base-path . ./file name

and that will use the solc that you installed using

npm install -g solc

Worked for me, hope it works for all of you

Upvotes: 1

Related Questions