Common migration pitfalls
A common mistake is to have a misconfigured truffle.js
file. Ensure that for each network you plan to deploy to, there should be a corresponding entry in the networks
object, stating the following information:
networks: { network_name: { network_id: <number> host: <string>, port: <number>, gas: <number> } }
How do we know what is the correct gas limit? Well, you have to play with this a little.
Every transaction you make has a gas cost. A migration is a transaction, too, and thus has a gas cost. When attemmpting to migrate your contract, you may run into this error:
exceeds block gas limit
Every transaction you send has a gas limit. Try to decrease the amount of gas specified.
Another error you may encounter is the following:
insufficient funds for gas * price + value
This means the total cost of the transaction exceeds your account's balance. So, you need to add more ether
to your account.
You may see the following error when...