当我在任何地方都有0.5.0并执行以下操作时,我想知道为什么会出现错误:
在我的Action.sol: pragma稳固^0.5.0;
Migrations.sol: pragma实体>=0.5.0 <0.6 0;
当运行truffle compile时,我得到:
Error: Could not find a compiler version matching 0.5.0. Please ensure you are specifying a valid version, constraint or build in the truffle config. Run `truffle compile --list` to see available versions.在test-a-smart-contract-with-truffle/truffle-config.js:中
compilers: {
solc: {
version: "0.5.0", 在/usr/本地/箱/松露:
compilers: {
solc: {
version: "0.5.0",
settings: {
optimizer: {
enabled: false,
runs: 200
},
evmVersion: "byzantium"
}
},
vyper: {}
},但是当我运行truffle compile --list时,我得到:
[
"0.5.4",
"0.5.3",
"0.5.2",
"0.5.1",
"0.5.0",
"0.4.25",
"0.4.24",
"0.4.23",
"0.4.22",
"0.4.21",
".. and 38 more. Use `--all` to see full list."
]发布于 2019-06-07 16:59:57
在我的例子中,为了更新松露,我运行以下命令: npm安装-g松露@5.0.21
发布于 2019-07-24 15:18:47
通过一次使用提升的权限来解决这个问题:sudo truffle compile -它将下载编译器,然后您可以继续使用非提升的命令truffle compile。这很可能是您系统上文件夹权限的一个问题,但我无法确定到底是哪个文件夹。上面的修复对我和其他我建议离线的人是有效的,所以很有可能它也会对你起作用。
https://ethereum.stackexchange.com/questions/67682
复制相似问题