繁体   English   中英

Truffle 只编译,不部署 - Ganache

[英]Truffle only compiles, does not deploy - Ganache

我在端口 8545 上使用 Ganache 启动了一个私有 blockchain.network。我有一些正在成功编译的智能合约。 但是,它们没有部署到 localhost:8545 的 connected.network

这是我的 truffle-config.js `

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*",
    },
  },
  mocha: {},
  compilers: {
    solc: {
      version: "0.8.17"
    }
  }
};

`

尝试松露迁移

我尝试了以下方法:

  1. 右键部署-不部署但显示成功
  2. 使用仅编译然后结束的migrate --reset
  3. 多次更改松露配置文件但都是徒劳的
  4. 已成功将我的项目添加到 Ganache,但所有已识别的智能合约都列为未部署

替换truffle-config.js中的以下代码:

 require("babel-register");
 require("babel-polyfill");

// We're settings up our networks to the Ganache Network
module.exports = {
    networks: {
        development: {
            host: "127.0.0.1",
            port: "7545",
            network_id: "*", // Connect to any network
        },
    },

    // The path of contracts folder
    contracts_directory: "./src/contracts",

    // The path of all our JSON Files
    contracts_build_directory: "./src/build/contracts",

    compilers: {
        solc: {
            version: "^0.8.0",
            optimizer: {
                enabled: true,
                runs: 200,
            },
        },
    },
};

它可能会有所帮助并解决问题!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM