trufflesuite / truffle-hdwallet-provider

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

npm install truffle-hdwallet-provider #75

Open ythalorossy opened 6 years ago

ythalorossy commented 6 years ago

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

$ npm install truffle-hdwallet-provider

scrypt@6.0.3 preinstall C:\Users\ythal\learning\udacity\blockchain\udacity_blockchain_developer_5\smart_contracts_erc721_open_zeppelin\node_modules\scrypt node node-scrypt-preinstall.js

scrypt@6.0.3 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 truffle-hdwallet-provider@0.0.6 requires a peer of truffle@4.x but none is installed. You must install peer dependencies yourself. npm WARN smart_contracts_erc721_open_zeppelin@1.0.0 No description npm WARN smart_contracts_erc721_open_zeppelin@1.0.0 No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! scrypt@6.0.3 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the scrypt@6.0.3 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

SirPhemmiey commented 6 years ago

Same error here...Have you fixed this?

jchopra12 commented 5 years ago

same problem.

rcarubbi commented 5 years ago

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!

gerry101 commented 5 years ago

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

BlackPanthar commented 4 years ago

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

lionel1702 commented 4 years ago

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