我一直在试图编译我的可靠智能契约,所以当我运行truffle compile时,我可以将它们部署到Ropsten测试网络上,这样就会出现以下错误:
TypeError: mnemonic.includes不是normalizePrivateKeys的一个函数
我不明白这个typeError是什么意思
以下是完整的信息:
TypeError: mnemonic.includes is not a function
at normalizePrivateKeys (C:\Users\aliya\node_modules\@truffle\hdwallet-provider\src\index.ts:62:38)
at new HDWalletProvider (C:\Users\aliya\node_modules\@truffle\hdwallet-provider\src\index.ts:102:25)
at Object.<anonymous> (C:\Users\aliya\ethereum\supplychain\truffle-config.js:31:23)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at Object.require (internal/modules/cjs/helpers.js:77:18)
at Function.load (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\index.js:161:1)
at Function.detect (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\index.js:150:1)
at Object.run (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\compile.js:53:1)
at Command.run (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command.js:136:1)
at Object.<anonymous> (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\cli.js:51:1)
at __webpack_require__ (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\bootstrap:19:1)
at C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\bootstrap:83:1
at Object.<anonymous> (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:89:10)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47使用坚固度0.6.8
松露v5.1.26 (核心: 5.1.26)
节点v12.16.2
这是我的块菌配置文件:
const HDWalletProvider = require("@truffle/hdwallet-provider");
const Wallet = require("ethereumjs-wallet.js"); //this line gives
let mainNetPrivateKey = new Buffer(secrets.mainnetPK, "hex");
let mainNetWallet = Wallet.fromPrivateKey(mainNetPrivateKey);
let mainNetProvider = new HDWalletProvider(
mainNetWallet,
"https://mainnet.infura.io/v3/***"
);
let ropstenPrivateKey = new Buffer(secrets.ropstenPK, "hex");
let ropstenWallet = Wallet.fromPrivateKey(ropstenPrivateKey);
let ropstenProvider = new HDWalletProvider(
ropstenWallet,
"https://ropsten.infura.io/v3/***"
);
module.exports = {
networks: {
development: {
host: "localhost", // Localhost (default: none)
port: 7545, // Standard Ethereum port (default: none)
network_id: "*",
gas: 4465030, // Any network (default: none)
},
ropsten: {
provider: ropstenProvider,
network_id: "3",
gas: 4465030,
},
live: {
provider: mainNetProvider,
network_id: "1",
gas: 7500000,
},
},
compilers: {
solc: {
version: "0.6.8",
},
}
},
},任何帮助都是很棒的!
发布于 2020-05-27 18:17:30
https://ethereum.stackexchange.com/questions/83769
复制相似问题