检查您的truffle.js
或truffle-config.js
如果您使用HDWalletProvider
下面的类似内容,这似乎是导致错误的原因
var HDWalletProvider = require("truffle-hdwallet-provider");
var mnemonic = "your mnemonic";
module.exports = {
networks: {
development: {
provider: function() {
return new HDWalletProvider(mnemonic, "http://127.0.0.1:8545/", 0, 50);
},
network_id: '*',
gas: 9999999
}
},
compilers: {
solc: {
version: "^0.4.25"
}
}
};
像下面一样删除 HDWalletProvider ,它解决了我的问题
module.exports = {
networks: {
development: {
host: "127.0.0.1", // Localhost
port: 8545, // Standard Ganache UI port
network_id: "*",
gas: 4600000
}
},
compilers: {
solc: {
version: "0.5.2"
}
}
};