标签 solidity 下的文章

truffle migrate命令执行时出现如下错误
Attempting to run transaction which calls a contract function, but recipient address is not a contract address
原因:build里面有旧的编译状态,而你的ganache已经重置了
解决方法:重置编译状态,执行 truffle migrate --reset

truffle compile常见问题
SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.24;
^----------------------^
solc编译器版本和合约要求的无法兼容,truffle目前很难换编译器,这种问题只能升级,降级truffle版本,比如上面这条错误,就需要把truffle从5.0降级到4.1.15
命令如下

npm uninstall -g truffle
npm i -g truffle@4.1.15