Error: No network specified. Cannot determine current network

Error: No network specified. Cannot determine current network

Truffle react-box 在默认设置下无法正常工作(使用 ganache 和 metamask)

download and run ganache then I followed the first 4 steps in the readme 并且当我进行松露迁移时,它在控制台中显示 'Error: No network specified. Cannot determine current network.'。

在 OSX 10.13.3 我进入根文件夹中的 truffle.js 文件并将其更改为

module.exports = {
  networks: {
    development: {
      host: '127.0.0.1',
      port: 7545,
      network_id: '*'
    }
  }
};

npm run start 在终端中,一切正常。不过,请确保背景中有 ganache 运行。

此外,请确保 ganache 中的 rpc 服务器与您刚刚更新的 truffle 文件中的主机和端口匹配。