[Ethereum] Error: Cannot find module ‘ethereumjs-wallet’

ethereumjsnodejstrufflewallets

A truffle test needs ethereumjs-wallet

const wallet = require('ethereumjs-wallet');

I tried

npm install ethereumjs-wallet

and even

npm uninstall ethereumjs-wallet
npm install --save ethereumjs-wallet@0.6.0

but ethereumjs-wallet is not listed on npm ls

When installing this is the result:

> scrypt@6.0.3 preinstall C:\Users\jj\node_modules\scrypt
> node node-scrypt-preinstall.js


> scrypt@6.0.3 install C:\Users\jj\node_modules\scrypt
> node-gyp rebuild


C:\Users\jj\node_modules\scrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files
\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Warning: Missing input files:
C:\Users\jj\node_modules\scrypt\build\..\scrypt\win\include\config.h
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Users\jj\node_modules\scrypt\build\copied_files.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
C:\Users\jj\node_modules\scrypt\build\scrypt_wrapper.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.C
pp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.1.7600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\jj\node_modules\scrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\jj\package.json'
npm WARN jj No description
npm WARN jj No repository field.
npm WARN jj No README data
npm WARN jj No license 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\jj\AppData\Roaming\npm-cache\_logs\2018-10-23T07_46_40_388Z-debug.log

Best Answer

Looks like it requires truffle-hd-wallet-provider.

Try: npm uninstall ethereumjs-wallet npm uninstall truffle-hdwallet-provider npm install --save ethereumjs-wallet@0.6.0 npm install --save truffle-hdwallet-provider@0.0.3

And then yeah, add these to package.json

Related Topic