0

I am trying to deploy a smart contract that works nicely in Ganache to a test net (Kovan).

However, all the tutorials out there use a package called hdwallet provider. When I follow the documentation and try to install it locally (then I tried globally) I keep getting this error:

Error: Cannot find module '@truffle/hdwallet-provider'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (D:\studies\Blockchain\***\truffle-config.js:2:24)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at Object.require (internal/modules/cjs/helpers.js:25:18)
    at Function.load (C:\Users\***\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\index.js:161:1)
    at Function.detect (C:\Users\***\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\index.js:150:1)
    at Object.run (C:\Users\***\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:189:1)
    at Command.run (C:\Users\***\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command.js:136:1)
    at Object.<anonymous> (C:\Users\***\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\cli.js:52:1)
    at __webpack_require__ (C:\Users\***\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\bootstrap 51589e08a62c87b5b792:19:1)
    at C:\Users\***\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\bootstrap 51589e08a62c87b5b792:62:1
    at Object.<anonymous> (C:\Users\***\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:68:10)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
Truffle v5.1.19 (core: 5.1.19)
Node v10.19.0

This error led me to do so many things: downgrade node to 10.19 (after I had 12) the reason was I kept getting errors with node-gyp which I could not for the life of me solve after 2 days when installing this package (hdwallet). tried with the old release of this package (truffle-hdwallet-provider) same issue.

if there is no solution to this, what is the best alternative to deploying to a testnet?

Thanks

EDIT: running npm install doesn't fix the problem. I get the following output

npm WARN bootstrap@4.4.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.4.1 requires a peer of popper.js@^1.16.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\mocha\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @truffle/hdwallet-provider@1.0.33
updated 1 package and audited 1039550 packages in 18.951s

63 packages are looking for funding
  run `npm fund` for details

found 5 vulnerabilities (3 low, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details
elGreato
  • 83
  • 1
  • 8
  • Sadly not, I saw that before. I ran npm install as I mentioned in my question – elGreato Apr 02 '20 at 14:59
  • Well, did you run npm fund like the printout tells you to? – goodvibration Apr 02 '20 at 15:08
  • yes but this warning never went away – elGreato Apr 02 '20 at 15:23
  • Do you have a link to the project? Are you installing in the correct directory? Or perhaps your node_modules/ directory is messed up try removing and reinstalling with npm install. Usually windows is not very well supported, I find running from WSL easier. – Ismael Apr 02 '20 at 15:43
  • I did remove and reinstall .. the project works, most of the packages that don't require node-gyp are installed correctly. I will upload it to GitHub and share the link – elGreato Apr 02 '20 at 17:02
  • npm install -g @truffle/hdwallet-provider – Majd TL Apr 08 '20 at 07:50

1 Answers1

0

The problem was Node version. so npm install was technically not installing the package since it depends on scrypt and node-gyp (both are having issues with node 12 and higher)

if you are facing the same problem, downgrade to node 10.xx or simply do not use this package and deploy your contract using remix.

elGreato
  • 83
  • 1
  • 8