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 [email protected] requires a peer of [email protected] - 3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of popper.js@^1.16.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] 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: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\mocha\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @truffle/[email protected]
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
6
  • Sadly not, I saw that before. I ran npm install as I mentioned in my question
    – elGreato
    Commented Apr 2, 2020 at 14:59
  • Well, did you run npm fund like the printout tells you to? Commented Apr 2, 2020 at 15:08
  • yes but this warning never went away
    – elGreato
    Commented Apr 2, 2020 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
    Commented Apr 2, 2020 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
    Commented Apr 2, 2020 at 17:02

1 Answer 1

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.

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