Truffle 迁移未部署到 Ganache

问题描述 投票:0回答:3

我尝试了命令 truffle migrate --reset,但无法连接到 Ganche 这是错误: enter image description here

这是 truufle-config.js 文件中的代码: enter image description here

这些是 RPC 服务器详细信息: enter image description here

blockchain ethereum solidity truffle ganache
3个回答
4
投票

您的

truffle-config.js
中似乎有一个拼写错误:
post
而不是
port

试试这个:

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

然后:

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

最后打开一个新终端并运行以下 2 个命令在托管文件

truffle-config.js
的同一文件夹中

truffle console ––network development

migrate ––reset

0
投票

试试这个:

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

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

truffle console ––network development

0
投票

我面临同样的问题,但是当将迁移文件名“first.js”更改为“1_first.js”时,它对我有用。 之后如果您遇到开发失败错误,则更改 solc 编译器版本 0.8.17 或最低版本。

© www.soinside.com 2019 - 2024. All rights reserved.