使用truffle遇到的问题

1:执行truffle migrate命令遇到如下错误

使用truffle遇到的问题_第1张图片

导致上面异常的原因为是因为truffle.js里面未配置链接合约发布的环境地址,找到对应的truffle.js文件,修改代码为类似如下配置即可解决问题:

使用truffle遇到的问题_第2张图片


2:继续执行truffle migrate又遇到如下错误:

Could not connect to your Ethereum client. Please check that your Ethereum client:

    - is running

    - is accepting RPC connections (i.e., "--rpc" option is used in geth)

    - is accessible over the network

    - is properly configured in your Truffle configuration file (truffle.js)


分析了一下geth启动命令

原来启动的命令是:geth --datadir testNet --dev   console 2>> test.log

加上--rpc选项,最终为 geth --datadir testNet --dev --rpc  console 2>> test.log 就可以解决问题。

你可能感兴趣的:(区块链)