遵循松露宠物店教程,并在运行松露迁移时遇到此错误:
ParsedContract.sol:3:1: ParserError: Source file requires different compiler version (current compiler is 0.5.2+commit.1df8f40c.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
contract Election {
^------^
Compilation failed. See above.
Truffle v5.0.0 (core: 5.0.0)
Node v11.2.0当运行松露版本时,我得到:
Truffle v5.0.0 (core: 5.0.0)
Solidity v0.5.0 (solc-js)
Node v11.2.0在我的合同中,我使用:
pragma solidity ^0.4.24有人遇到过这个问题吗?如果你能帮我渡过难关,我将不胜感激。
发布于 2018-12-23 02:50:54
您使用的是松露v5,默认情况下它将使用Solcv0.5.0。
但是您可以添加一个配置选项来指定要使用的solc版本。
module.exports = {
...
compilers: {
solc: {
version: "^0.4.25"
}
}
};IMHO更好的选择是将您的合同迁移到solc v0.5.0。
https://ethereum.stackexchange.com/questions/64493
复制相似问题