current position:Home>What is the problem that the version of the solid compiler cannot be matched after the truss compile prompt

What is the problem that the version of the solid compiler cannot be matched after the truss compile prompt

2022-02-03 20:51:14 Q & A of Denglian community




Take the answer 1:

Hello , This problem is because you are in the environment Truffle What is used Solidity The compiler version is inconsistent with the compiler version required by your contract code .

To look at first truffle Default solidity edition

truffle version

The current default compiler version will be displayed

Truffle v5.1.6 (core: 5.1.6)Solidity v0.5.12 (solc-js)Node v12.9.0Web3.js v1.2.1

Then check the compiler configuration in the project Configure in truffle-config.js In file , By default, there is no compilers To configure ( see Truffle The configuration document ).

without , The default compiler version is used .

Modify compiler configuration

Because your contract is 0.5.12 Version for , So you can truffle-config.js In the definition of solc Compiler version requirements .

The code is as follows :

module.exports = {   compilers: {    solc: {      version: "0.5.12",    }  }};





Other answers 1:


Other answers 2:

copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202032051114298.html

Random recommended