trufflesuite / truffle-hdwallet-provider

HD Wallet-enabled Web3 provider
MIT License
400 stars 167 forks source link

Package is unable to find ethereumjs-wallet\hkey #54

Closed roschler closed 6 years ago

roschler commented 6 years ago

I'm trying to deploy on Rinkeby and I am hitting a snag with Truffle. It can't find the ethereumjs-wallet package during a migrate. I tried installing ethereumjs-wallet globally with npm, locally, doesn't work. I even tried switching to the ../node_modules/truffle-hdwallet-provider directory and using npm to install it there. Still doesn't work. Any ideas? I am using Truffle version. 4.1.4:

Error: Cannot find module 'ethereumjs-wallet/hdkey'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
    at Function.Module._load (internal/modules/cjs/loader.js:520:25)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/robert/Documents/GitHub/ME/ether-band-battles-work/solidity/node_modules/truffle-hdwallet-provider/index.js:2:13)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/robert/Documents/GitHub/ME/ether-band-battles-work/solidity/truffle.js:2:24)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Function.Config.load (/home/robert/.nvm/versions/node/v10.2.1/lib/node_modules/truffle/build/webpack:/~/truffle-config/index.js:259:1)
    at Function.Config.detect (/home/robert/.nvm/versions/node/v10.2.1/lib/node_modules/truffle/build/webpack:/~/truffle-config/index.js:248:1)
    at Object.run (/home/robert/.nvm/versions/node/v10.2.1/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/migrate.js:35:1)
    at Command.run (/home/robert/.nvm/versions/node/v10.2.1/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/command.js:101:1)
    at Object.<anonymous> (/home/robert/.nvm/versions/node/v10.2.1/lib/node_modules/truffle/build/webpack:/~/truffle-core/cli.js:16:1)
    at __webpack_require__ (/home/robert/.nvm/versions/node/v10.2.1/lib/node_modules/truffle/build/webpack:/webpack/bootstrap b4601922d6f11f8bff0b:19:1)
    at /home/robert/.nvm/versions/node/v10.2.1/lib/node_modules/truffle/build/webpack:/webpack/bootstrap b4601922d6f11f8bff0b:65:1
    at Object.<anonymous> (/home/robert/.nvm/versions/node/v10.2.1/lib/node_modules/truffle/build/cli.bundled.js:71:10)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)

Here's my config file (truffle.js):

var HDWalletProvider = require("truffle-hdwallet-provider");
var mnemonic = "<redacted>";
var rinkebyUrlAndApiKey = "<redacted>";

module.exports = {
  networks: {
    local: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*" // Match any network id
    },
    rinkeby: {
      provider: function() {
        return new HDWalletProvider(
          mnemonic,
          rinkebyUrlAndApiKey, 
          0);
      },
      network_id: 4
    }
  }
};
grinbuck commented 6 years ago

I'm facing the same problem. Installing ethereumjs-wallet locally or globally does not help.

RtillaWork commented 6 years ago

Tried

npm install --save ethreumjs-wallet@0.6.0 

Looks like the filetree in node_modules for ethereumjs-wallet has changed between 0.6.0 and 0.61 and broke compatibility.

I tried this and it ran this time with warnings. No return of transaction hash and no transaction showed up on etherscan though. So it failed, but I think it's something else.

attempting to deploy from account  0x*********************************
(node:11468) UnhandledPromiseRejectionWarning: TypeError: CreateListFromArrayLike called on non-object
    at Contract.deploy (S:\ethtest\node_modules\web3-eth-contract\src\index.js:503:33)
    at deploy (S:\ethtest\deploy.js:17:6)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:11468) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11468) [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.
RtillaWork commented 6 years ago

Update:
Try:

npm uninstall ethereumjs-wallet
npm uninstall truffle-hdwallet-provider
npm install ethereumjs-wallet@0.60
npm install --save truffle-hdwallet-provider@0.0.3

Credit goes to 2 gentlemen on udemy QA Sarshad and Guang

roschler commented 6 years ago

@na55ime Thank for your post. That is indeed the problem. To everyone, please note, a minor correction to his post:

npm install ethereumjs-wallet@0.6.0 --save

I didn't need to provide a version number for the truffle-hdwallet-provider package install. Make sure you uninstall any global versions of the two packages if you still have trouble.

cgewecke commented 6 years ago

@roschler thanks for reporting.

Just opened a PR pinning wallet to 0.6.0. . . .will merge and publish ASAP.

cgewecke commented 6 years ago

This should be fixed with0.0.6. Please ping if you're still seeing it.

roschler commented 6 years ago

What happens if ethereumjs-wallet fixes an important bug in a later version Chris?

On Sun, Jul 29, 2018 at 10:53 PM, c-g-e-w-e-k-e-> notifications@github.com wrote:

Closed #54 https://github.com/trufflesuite/truffle-hdwallet-provider/issues/54.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/trufflesuite/truffle-hdwallet-provider/issues/54#event-1759196652, or mute the thread https://github.com/notifications/unsubscribe-auth/AEcdBz03B2rxJh_EC37YAcI6Ym5ZAhk-ks5uLnVHgaJpZM4VlTc0 .

-- Thanks, Robert Oschler Twitter: https://twitter.com/roschler http://twitter.com/roschler LinkedIn: https://www.linkedin.com/in/natlang/

cgewecke commented 6 years ago

@roschler Yes, agree - I just want to test it out a little more thoroughly and stop the crashing in the interim - will republish again this week after fixing the underlying compatibility problem.