找不到ganache-cli依赖项

时间:2018-08-18 19:05:53

标签: blockchain ethereum solidity

我正在尝试在 Next.js 应用程序中使用 ganache web3.js

我在终端中运行 ganache-cli 的实例,然后使用 ganache 作为提供程序创建 web3.js 的实例使用以下代码:

...
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3( new web3.providers.HttpProvider("http://localhost:8545"));
module.exports = web3;

但是,在启动应用程序时,出现以下错误:

  

ganache-cli错误
  找不到模块:错误:无法解析“ C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ ganache-cli \ build”中的“ child_process”   ModuleNotFoundError:找不到模块:错误:无法解析'C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ ganache-cli \ build'中的'child_process'
      在factoryCallback(C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ webpack \ lib \ Compilation.js:269:40)
      在工厂(C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ webpack \ lib \ NormalModuleFactory.js:235:20)
      在解析器上(C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ webpack \ lib \ NormalModuleFactory.js:60:20)
      在asyncLib.parallel(C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ webpack \ lib \ NormalModuleFactory.js:127:20)
      在C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ async \ dist \ async.js:3888:9
      在C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ async \ dist \ async.js:473:16
      在iteratorCallback(C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ async \ dist \ async.js:1062:13)
      在C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ async \ dist \ async.js:969:16
      在C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ async \ dist \ async.js:3885:13
      在resolvers.normal.resolve(C:\ Users \ migue \ Desktop \ Microgrid-Blockchain-Project \ node_modules \ webpack \ lib \ NormalModuleFactory.js:119:22)   ```   如错误消息所建议,我尝试安装缺少的软件包,但无济于事。删除并重新安装 ganache 也无济于事。

关于为什么会发生这种情况的任何想法?
我该如何解决?

0 个答案:

没有答案