EatTheBlocks Forum

"Migrations" ran out of gas (using Truffle's estimate.)

Hi, I am working on the crud project on the frontend section when I received an error that tells me that migrations ran out of gas.

“Migrations” ran out of gas. Something in the constructor (ex: infinite loop) caused gas estimation to fail. Try:

  • Making your contract constructor more efficient
  • Setting the gas manually in your config or as a deployment parameter
  • Using the solc optimizer settings in ‘truffle-config.js’
  • Setting a higher network block limit if you are on a
    private network or test client (like ganache).

First, the error was complaining about the constructor, but there was no constructor in the smart contract(.sol file).

I also searched for ways to get around it including solc optimizer according to solutions on stack overflow, but it still recieving the error.

const fs = require('fs');
const HDWalletProvider = require("truffle-hdwallet-provider");
const secrets = JSON.parse(

module.exports = {
  networks: {
    ropsten: {
      provider: () =>
        new HDWalletProvider(
      network_id: 3 

    solc: {
        optimizer: {
            enabled: true,
            runs: 200

Anyone having ideas how to get around this problem?

Sorry for the late reply.

Do you have enough ETH in the deploying address? Also, you can try adding a specific default gas limit in the parameters of the ropsten network in your config (gas parameter).