Truffle配置Sepolia测试网时出现network_id未指定错误的求助
Truffle配置Sepolia测试网时出现network_id未指定错误的求助
大家好,我在配置Truffle连接Sepolia测试网时遇到了奇怪的问题——明明已经在配置文件里写了network_id,但运行时还是报错说必须指定这个参数,实在搞不懂哪里出问题了,想请大家帮忙看看。
先附上我的truffle-config.js完整代码:
require("babel-register"); const HDWalletProvider = require("truffle-hdwallet-provider"); require("dotenv").config(); module.exports = { networks: { Sepolia: { provider: function() { return new HDWalletProvider( process.env.MNEMONIC, process.env.PROJECT_ENDPOINT, address_index=0, num_addresses=2 ); }, network_id: 11155111 , gas: 4500000, gasPrice: 10000000000, }, development: { host: process.env.LOCAL_ENDPOINT.split(":")[1].slice(2), port: process.env.LOCAL_ENDPOINT.split(":")[2], network_id: "*", }, compilers: { solc: { version: "^0.4.24", }, }, }, };
我收到的错误提示截图如下:
对应的完整错误日志:
Error: You must specify a network_id in your 'Sepolia' configuration in order to use this network. at Object.validateNetworkConfig (C:\Users\aditi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\environment\environment.js:136:1) at Object.detect (C:\Users\aditi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\environment\environment.js:16:1) at Object.module.exports [as run] (C:\Users\aditi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate\run.js:19:1) at runCommand (C:\Users\aditi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command-utils.js:297:1)
我的环境版本信息:
- Truffle v5.11.5 (core: 5.11.5)
- Node v18.17.0
有没有大佬能帮我排查下问题所在呀?
备注:内容来源于stack exchange,提问作者Aditi Singh
相关产品推荐
相关产品推荐

