ErickAgrazal
ErickAgrazal

Reputation: 83

How to fix "Unknown network "ganache". See your Truffle configuration file for available networks."

I'm trying to deploy a contract to rinkeby. I'm using the following command:

$ 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

It works witch ganache-cli but it doesn't work with rinkeby, because its giving me the error of Unknown network "ganache". See your Truffle configuration file for available networks as showed in the result above.

This is my 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
    }
  }
};

Upvotes: 3

Views: 2897

Answers (1)

ErickAgrazal
ErickAgrazal

Reputation: 83

For anyone having this error, my problem was that I was writting wrong the command. The correct form should be: truffle migrate --network rinkeby # Network is without the 's'

Upvotes: 3

Related Questions