Fehler: Modul 'web 3' kann nicht gefunden werden

Wenn ich npm run test (mocha) ausführe, erhalte ich diese Meldung. Verwenden Sie Folgendes: npm install --save mocha ganache-cli web3@1.0.0-beta.26 Bitte um Rat.

> 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:
Nicht allzu vertraut mit Mocha-Tests außerhalb von Truffle, aber haben Sie versucht, web3 zu deinstallieren und dann npm zu installieren?
Absolut. Egal welche Version von web3 ich installiere, es wird immer noch der gleiche Fehler erzeugt.
@SergeiStadnik Kannst du die ersten Zeilen des Fehlertests setzen inbox.test.js? dh die Zeilen, in denen Sie versuchen, 'web3' zu benötigen.
Ich habe die Anwendung umgeschrieben, sie hatte einige Syntaxfehler. Jetzt erhalte ich einen anderen Fehler: Fehler: Modul 'ganache-cli' kann nicht gefunden werden

Antworten (1)

Wenn Sie Windows verwenden, öffnen Sie Ihr Terminal als Administrator und führen Sie den folgenden Befehl aus:

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