ethereum - 如何修复“未知网络“ganache”。有关可用网络,请参阅您的 Truffle 配置文件。”
问题描述
我正在尝试将合同部署到rinkeby。我正在使用以下命令:
$ truffle migrate --networks rinkeby
Compiling your contracts...
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/Voting.sol
> Artifacts written to ./public/contracts/build/
> Compiled successfully using:
- solc: 0.5.8+commit.23d335f2.Emscripten.clang
Unknown network "ganache". See your Truffle configuration file for available networks.
Truffle v5.0.22 (core: 5.0.22)
Node v11.6.0
它适用于女巫ganache-cli
,但不适用于 rinkeby,因为它给了我Unknown network "ganache". See your Truffle configuration file for available networks
如上面结果所示的错误。
这是我的truffle-config.js
:
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
contracts_build_directory: path.join(__dirname, "./public/contracts/build/"),
networks: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: 1000,
gas: 4612388,
gasPrice: 25000000000,
total_accounts: 20,
mnemonic
},
rinkeby: {
provider: () => new HDWalletProvider(mnemonic, infuraURL),
network_id: 4,
gas: 4612388,
gasPrice: 25000000000,
},
},
solc: {
optimizer: {
enabled: true,
runs: 200
}
}
};
解决方案
对于任何有此错误的人,我的问题是我写错了命令。正确的形式应该是:
truffle migrate --network rinkeby # Network is without the 's'
推荐阅读
- python-3.x - 提取文本 OpenCV 轮廓
- php - 比较两个日期,第二个日期应该大于 php 中的第一个日期
- parsing - Pug 上下文是免费的吗?
- ios - 编辑器中缺少 Xcode 文件
- neo4j - 获取neo4j查询的个别结果
- pdf - 如何查找存储在 HDFS 中的两个 PDF 之间的相似度分数
- javascript - 如何以正确的方式创建由我的 Rails 应用程序变量初始化的全局 js 变量?
- java - 如何使用 Jackson 绑定 Map
bean的参数? - java - how to get Json objects from json array and use them with model class
- javascript - 查看具有完美同步热图的树状图