1

When I am running npm run test (mocha), I am getting this message. Using following: npm install --save mocha ganache-cli web3@1.0.0-beta.26 Please advice.

> smart@1.0.0 test C:\Smart
> mocha

Error: Cannot find module 'web3'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Smart\test\inbox.test.js:3:14)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at C:\Smart\node_modules\mocha\lib\mocha.js:253:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (C:\Smart\node_modules\mocha\lib\mocha.js:250:14)
    at Mocha.run (C:\Smart\node_modules\mocha\lib\mocha.js:577:10)
    at Object.<anonymous> (C:\Smart\node_modules\mocha\bin\_mocha:591:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! smart@1.0.0 test: `mocha`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the smart@1.0.0 test 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:
  • 1
    Not too familiar with mocha testing outside of truffle, but have you tried uninstalling and then npm install web3 ? – thefett Apr 24 '18 at 19:00
  • Absolutely.No matter what version of web3 I install, it still producing the same error. – monkrus Apr 24 '18 at 21:51
  • @SergeiStadnik Can you put the first lines of the failing test inbox.test.js? ie the lines where you to try to require 'web3'. – Ismael Apr 25 '18 at 1:55
  • I rewrote the application, it had some syntax errors.Now I am getting a different error: Error: Cannot find module 'ganache-cli' – monkrus Apr 25 '18 at 19:56
1

If you are on windows, open up your terminal as administrator and run the following command:

npm install --global --production windows-build-tools

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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