Truffle: Truffle compile hangs indefinitely when `[email protected]` is imported into the truffle.js

Created on 15 Jun 2018  路  4Comments  路  Source: trufflesuite/truffle

Reproduce:

git clone [email protected]:skmgoldin/tcr.git
git checkout cd38e2666660c460083953d2f4c93c81aea4923b
npm i
npx truffle compile

That _works_. Now open the truffle.js and un-comment everything. Nuke the build directory and npx truffle compile again. It will hang forever.

Truffle 4.1.11, Ubuntu 16.

Most helpful comment

@skmgoldin Yes. If you have multiple providers declared in truffle.js you now must wrap them in a function closure. This:

provider: new HDWalletProvider(mnemonic, 'https://mainnet.infura.io'),

has to be like this:

provider: function() {
   return new HDWalletProvider(mnemonic, "https://mainnet.infura.io/");
},

We recently upgraded the provider-engine in HDWallet because the old one was generating npm audit warnings and something is different about the way it polls. Any time the config is loaded into truffle (even for compile) it will open all of the listed connections unless they're wrapped, and our efforts to close handlers on exit are not working when several providers are open for some reason.

All 4 comments

@skmgoldin Yes. If you have multiple providers declared in truffle.js you now must wrap them in a function closure. This:

provider: new HDWalletProvider(mnemonic, 'https://mainnet.infura.io'),

has to be like this:

provider: function() {
   return new HDWalletProvider(mnemonic, "https://mainnet.infura.io/");
},

We recently upgraded the provider-engine in HDWallet because the old one was generating npm audit warnings and something is different about the way it polls. Any time the config is loaded into truffle (even for compile) it will open all of the listed connections unless they're wrapped, and our efforts to close handlers on exit are not working when several providers are open for some reason.

That worked! I was even able to use a more concise syntax:

    mainnet: {
      provider: () => new HDWalletProvider(mnemonic, 'https://mainnet.infura.io'),
      network_id: '1',
      gas: 4500000,
      gasPrice: 10000000000,
    },

Thanks @cgewecke !

Sweet! Looking at #1023 right now.

Thanks. Still having the same failure there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rstormsf picture rstormsf  路  3Comments

oed picture oed  路  3Comments

tcurdt picture tcurdt  路  3Comments

bmmpxf picture bmmpxf  路  3Comments

ripper234 picture ripper234  路  4Comments