首页 > 解决方案 > 未找到 ganache-cli 子进程依赖项

问题描述

我正在尝试在令牌向导应用程序中使用 ganache 和 web3.js。

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

try {
        window.web3 = new Web3(window.web3.currentProvider)
        this.setState({
          approvePermissions: true,
          web3: window.web3
        })
      } catch (err) {
        console.log('There was a problem fetching accounts', err)
      }

当我启动我的应用程序时,我收到以下错误:

Error in ganache-cli
Module not found: Error: Can't resolve 'child_process' in 'C:\Users\name\Desktop\wiz\node_modules\ganache-cli\build'

任何人有想法解决它?

标签: node.jsethereum

解决方案


推荐阅读