错误:Truffle 当前使用 solc 0.5.16,但您的一个或多个合约指定“pragma Solidity ^0.8.0”

Pal*_*alm 11 blockchain ethereum solidity smartcontracts truffle

错误:Truffle 当前使用 solc 0.5.16,但您的一个或多个合约指定 \xe2\x80\x9cpragma Solidity ^0.8.0\xe2\x80\x9d

\n

这是错误的照片 - https://gyazo.com/2f5ea2f50cc1d4ef5eea2f21d0e04fe7

\n

我的所有合约都使用 ^0.8.0 编译指示。我的 truffle-config 也使用与您在此处看到的相同的版本 -https://gyazo.com/1ec8b28ca48902c091004f8659cf678d

\n

请帮忙。非常感谢。

\n

Yil*_*maz 11

省略“^”。不是version:"^0.8.0"

compilers: {
       solc: {
           version: "0.8.0"  
       }
}
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,明确的版本声明成功了! (2认同)