truffle-hdwallet-provider icon indicating copy to clipboard operation
truffle-hdwallet-provider copied to clipboard

npm install truffle-hdwallet-provider

Open ythalorossy opened this issue 7 years ago • 6 comments

OS: Windows 10 $ node -v && npm -v v10.11.0 6.4.1

$ npm install truffle-hdwallet-provider

[email protected] preinstall C:\Users\ythal\learning\udacity\blockchain\udacity_blockchain_developer_5\smart_contracts_erc721_open_zeppelin\node_modules\scrypt node node-scrypt-preinstall.js

[email protected] install C:\Users\ythal\learning\udacity\blockchain\udacity_blockchain_developer_5\smart_contracts_erc721_open_zeppelin\node_modules\scrypt node-gyp rebuild

C:\Users\ythal\learning\udacity\blockchain\udacity_blockchain_developer_5\smart_contracts_erc721_open_zeppelin\node_modules\scrypt>if not defined npm_config_node_gyp (node "C:\Users\ythal\nvm\v10.11.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\ythal\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (C:\Users\ythal\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19) gyp ERR! stack at PythonFinder. (C:\Users\ythal\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16) gyp ERR! stack at C:\Users\ythal\nvm\v10.11.0\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:154:21) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\ythal\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\ythal\learning\udacity\blockchain\udacity_blockchain_developer_5\smart_contracts_erc721_open_zeppelin\node_modules\scrypt gyp ERR! node -v v10.11.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself. npm WARN [email protected] No description npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\ythal\AppData\Roaming\npm-cache_logs\2018-10-28T19_11_53_119Z-debug.log

ythalorossy avatar Oct 28 '18 19:10 ythalorossy

Same error here...Have you fixed this?

SirPhemmiey avatar Nov 08 '18 08:11 SirPhemmiey

same problem.

jchopra12 avatar Dec 18 '18 20:12 jchopra12

Hi guys after facing many issues I finally could run truffle migrate in my production environment following these steps below:

  1. run cmd install with admin rights
  2. npm install -g truffle
  3. npm install -g windows-build-tools
  4. npm install -g node-gyp
  5. set npm_config_node_gyp=%appdata%\npm\node_modules\node-gyp\bin\node-gyp.js
  6. md your_project_name
  7. cd your_project_name
  8. npm init -y
  9. npm install truffle-hdwallet-provider -s
  10. truffle init
  11. code your solidity contract
  12. configure your 2_deploy_contract.js file
  13. configure your truffle-config.js file including the section:
    production: { provider: () => new HDWalletProvider(mnemonic, your rpc endpoint), network_id: 10101010, // This network is yours, in the cloud. gasPrice: 0 // it´s necessary to allow deploy contracts on a PoA network }
  14. uncomment these lines in the top of config file const HDWalletProvider = require('truffle-hdwallet-provider'); const fs = require('fs'); const mnemonic = fs.readFileSync(".secret").toString().trim();
  15. Create a .secret file in your root project directory including your wallet mnemonic
  16. truffle compile
  17. truffle migrate --network production

Hope it helps you guys!

rcarubbi avatar Jul 02 '19 21:07 rcarubbi

This is not a safe fix. But if only for testing purposes, add --unsafe-perm=true --allow-root to the install command.

gerry101 avatar Nov 22 '19 09:11 gerry101

I had this problem. What worked was replacing the "truffle-hdwallet-provider" in the require method argument at here: const HDWalletProvider = require('truffle-hdwallet-provider');

with '@truffle/hdwallet-provider'

const HDWalletProvider = require('@truffle/hdwallet-provider');

and truffle compile finally worked

BlackPanthar avatar Apr 15 '20 17:04 BlackPanthar

truffle-hd-wallet provider has been deprecated: https://www.npmjs.com/package/truffle-hdwallet-provider

Instead use @truffle/hdwallet-provider: https://www.npmjs.com/package/@truffle/hdwallet-provider

After this @truffle/hdwallet-provider will be successfully installed - then reference in required file as follows:

var HDWalletProvider = require("@truffle/hdwallet-provider");

got the source from: https://ethereum.stackexchange.com/questions/62574/error-cannot-find-module-truffle-hdwallet-provider/82503#82503?newreg=f0f7e403a22046ffb314939227ce9746

lionel1702 avatar Aug 23 '20 19:08 lionel1702