使用truffle和testrpc的版本如下:
Truffle v5.1.61 (core: 5.1.61)
Solidity v0.5.16 (solc-js)
Node v14.15.4
Web3.js v1.2.9
EthereumJS TestRPC v6.0.3
在truffle migrate之前,我已经修改了truffle-config.js文件为:
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // 匹配任何network id
}
}
};
然后,输入命令testrpc启动一个区块链网络
在完成编译的情况下,输入命令“truffle migrate”,显示失败,并且刚刚启动的testrpc网络也崩溃:
可以看到truffle migrate的报错是“Could not connect to your Ethereum client with the following parameters:”,也就是说testrpc网络连接不上了,而testrpc网络正是因为truffle migrate而崩溃的。这是为什么呢?
求大神指点!!!