3

我正在尝试将合同部署到rinkeby。我正在使用以下命令:

$ truffle migrate --networks rinkeby

Compiling your contracts...
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/Voting.sol
> Artifacts written to ./public/contracts/build/
> Compiled successfully using:
   - solc: 0.5.8+commit.23d335f2.Emscripten.clang

Unknown network "ganache". See your Truffle configuration file for available networks.
Truffle v5.0.22 (core: 5.0.22)
Node v11.6.0

它适用于女巫ganache-cli,但不适用于 rinkeby,因为它给了我Unknown network "ganache". See your Truffle configuration file for available networks如上面结果所示的错误。

这是我的truffle-config.js

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  contracts_build_directory: path.join(__dirname, "./public/contracts/build/"),
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: 1000,
      gas: 4612388,
      gasPrice: 25000000000,
      total_accounts: 20,
      mnemonic
    },
    rinkeby: {
      provider: () => new HDWalletProvider(mnemonic, infuraURL),
      network_id: 4,
      gas: 4612388,
      gasPrice: 25000000000,
    },
  },
  solc: {
    optimizer: {
        enabled: true,
        runs: 200
    }
  }
};
4

1 回答 1

3

对于任何有此错误的人,我的问题是我写错了命令。正确的形式应该是: truffle migrate --network rinkeby # Network is without the 's'

于 2019-06-17T14:47:41.910 回答