首页 > 解决方案 > Truffle 迁移未部署到 Ganache

问题描述

我尝试了命令 truffle migrate --reset,但它无法连接到 Ganche,这是错误: 在此处输入图像描述

这是 truufle-config.js 文件中的代码: 在此处输入图像描述

这些是 RPC 服务器的详细信息: 在此处输入图像描述

标签: blockchainethereumsoliditytruffleganache

解决方案


您的truffle-config.js:post而不是port.

试试这个:

  networks: {
    development: {
      host: "127.0.0.1",
      port: 9545,
      network_id: "*"
    }
  },

然后:

  • 仔细检查 Ganache 上的设置与上的设置是否匹配truffle-config.js
  • 检查 Ganache 是否正在运行。

最后打开一个新终端并在托管文件的同一文件夹中truffle-config.js运行以下 2 个命令:

truffle console ––network development

migrate ––reset

推荐阅读