4

root@ubuntu-4gb-nyc3-01:~# truffle migrate --network ropsten (node:14686) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: this.provider.sendAsync is not a function (node:14686) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. Using network 'ropsten'.

Running migration: 1_initial_migration.js

After that it exits to root@ubuntu-4gb-nyc3-01:~# without running 2_deploy_contracts.js

My truffle.js looks like the following :

**var bip39 = require("bip39");
var hdkey = require('ethereumjs-wallet/hdkey');
var ProviderEngine = require("web3-provider-engine");
var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js');
var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js");
var Web3 = require("web3");
// Get our mnemonic and create an hdwallet
var mnemonic = "twelve words we can find in metamask settings reveal seed words blabla";
var hdwallet = hdkey.fromMasterSeed(bip39.mnemonicToSeed(mnemonic));
// Get the first account using the standard hd path.
var wallet_hdpath = "m/44'/60'/0'/0/";
var wallet = hdwallet.derivePath(wallet_hdpath + "0").getWallet();
var address = "0x" + wallet.getAddress().toString("hex");
console.log(address);
var providerUrl = "https://ropsten.infura.io/mytoken";
var engine = new ProviderEngine();
engine.addProvider(new WalletSubprovider(wallet, {}));
engine.addProvider(new Web3Subprovider(new Web3.providers.HttpProvider(providerUrl)));
engine.start(); // Required by the provider engine.
module.exports = {
  networks: {
    ropsten: {
      network_id: 3,    // Official ropsten network id
      provider: engine, // Use our custom provider
      from: address,     // Use the address we derived
      gas: 3000000
    }
  },
  rpc: {
    // Use the default host and port when not using ropsten
    host: "my-server-ip-goes-here",
    port: 8545
  }
  };**

Where will I find this.provider.sendAsync function?

I m using node : v8.2.1 and Ubuntu 16.04

I m really stuck with this. Any help would be appreciated. Thanks

3

I had the same error. It was solved after I installed the old version of the npm libralies. I don't think this is the ideal solution.

$ npm install ethereumjs-wallet bip39 web3-provider-engine@8.6.1 web3@0.18.4 zeppelin-solidity --save
0

did you changed this value of var mnemonic = "twelve words we can find in metamask settings reveal seed words blabla"; to your phrase METAMASK

  • okay I see. do I have to change the mnemonics? you mean I have to use actual metamask chrome extension and then get the value from there? I m sorry. I got confused. – Gerstaro Jones Aug 7 '17 at 4:01
  • yes, it will be creat your contarct by first address eth on metamask – TahaBA Aug 7 '17 at 4:18
  • I created a 12 word mnemonic from metamask plugin from chrome. and then tried to deploy the conract in ropsten again after updating the truffle.js with the new mnemonic. Again the same error :UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: this.provider.sendAsync is not a function (node:22993) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. – Gerstaro Jones Aug 7 '17 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.