微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

npm hardhat 运行后连接到本地主机时出错

如何解决npm hardhat 运行后连接到本地主机时出错

我是使用安全帽部署智能合约的新手,正在学习 https://dev.to/dabit3/the-complete-guide-to-full-stack-ethereum-development-3j13 上的教程。但是,在运行 npx hardhat run scripts/deploy.js --network localhost 后,出现以下错误。关于如何解决连接问题的任何想法?

HardhatError: HH108: Cannot connect to the network localhost.
    Please make sure your node is running,and check your internet connection and networks config
        at HttpProvider._fetchJsonRpcResponse (/Users/cuneydtasoglu/Desktop/hardhat_list/blockchain/node_modules/hardhat/src/internal/core/providers/http.ts:176:15)
        at processticksAndRejections (node:internal/process/task_queues:93:5)
        at HttpProvider.request (/Users/cuneydtasoglu/Desktop/hardhat_list/blockchain/node_modules/hardhat/src/internal/core/providers/http.ts:55:29)
        at GanacheGasMultiplierProvider._isGanache (/Users/cuneydtasoglu/Desktop/hardhat_list/blockchain/node_modules/hardhat/src/internal/core/providers/gas-providers.ts:302:30)
        at GanacheGasMultiplierProvider.request (/Users/cuneydtasoglu/Desktop/hardhat_list/blockchain/node_modules/hardhat/src/internal/core/providers/gas-providers.ts:291:23)
        at EthersProviderWrapper.send (/Users/cuneydtasoglu/Desktop/hardhat_list/blockchain/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
        at Object.getSigners (/Users/cuneydtasoglu/Desktop/hardhat_list/blockchain/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:23:20)
        at getContractFactoryByAbiAndBytecode (/Users/cuneydtasoglu/Desktop/hardhat_list/blockchain/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:250:21)
        at main (/Users/cuneydtasoglu/Desktop/hardhat_list/blockchain/scripts/deploy.js:17:19)
    
        Caused by: FetchError: request to http://127.0.0.1:8545/ Failed,reason: connect ECONNREFUSED 127.0.0.1:8545
            at ClientRequest.<anonymous> (/Users/cuneydtasoglu/Desktop/hardhat_list/blockchain/node_modules/node-fetch/lib/index.js:1461:11)
            at ClientRequest.emit (node:events:376:20)
            at Socket.socketErrorListener (node:_http_client:490:9)
            at Socket.emit (node:events:376:20)
            at emitErrorNT (node:internal/streams/destroy:188:8)
            at emitErrorCloseNT (node:internal/streams/destroy:153:3)
            at processticksAndRejections (node:internal/process/task_queues:80:21)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?