0

我是布朗尼的新手。当我跟着视频https://www.youtube.com/watch?v=M576WGiDBdQ学习如何使用 Brownie 部署区块链合约时,它给了我一个错误。RPCConnectionError: Able to launch RPC client, but unable to connect.

似乎布朗尼启动ganache-cli并使用“http://127.0.0.1:8545”作为本地测试区块链网络的URI,但不知何故它没有连接到ganache-cli核心,但我尝试ganache-cli单独启动,一切正常。我将 Brownie 与代理一起使用,但即使我关闭代理,它仍然无法连接到ganache-cli. 以下是错误代码。

(base) D:\OneDrive\xjtu\Labs\blockchain\solidity\bronie_simple_storage>brownie run scripts/deploy.py
INFO: Could not find files for the given pattern(s).
Brownie v1.17.2 - Python development framework for Ethereum

BronieSimpleStorageProject is the active project.

Launching 'ganache-cli.cmd --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
Terminating local RPC client...
  File "c:\users\zheng\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\_cli\__main__.py", line 64, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "c:\users\zheng\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\_cli\run.py", line 44, in main
    network.connect(CONFIG.argv["network"])
  File "c:\users\zheng\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\main.py", line 50, in connect
    rpc.launch(active["cmd"], **active["cmd_settings"])
  File "c:\users\zheng\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\__init__.py", line 95, in launch
    raise RPCConnectionError(cmd, self.process, uri)
RPCConnectionError: Able to launch RPC client, but unable to connect.

Command: ganache-cli
URI: http://127.0.0.1:8545
Exit Code: 15
BronieSimpleStorageProject is the active project.
4

3 回答 3

0
└─mainnet-fork-dev
    ├─id: mainnet-fork-dev
    ├─cmd: ganache-cli
    ├─cmd_settings: {'accounts': 10, 'fork': '{Insert Alchemy Link here}', 'mnemonic': 'brownie', 'port': 8545}
    └─host: http://127.0.0.1

这就是我的样子,它可能会有所帮助

于 2022-01-12T14:42:00.603 回答
0

您必须降级您的 nvm 版本才能使其正常工作。 GitHub 上相关问题的链接

您只需要将节点版本降级到 16.13.2 [仅限 WSL2]:

nvm uninstall <current version>

nvm install 16.13.2

nvm use 16.13.2
于 2022-01-18T23:37:44.893 回答
0

ganache 默认连接到端口 7545,但 ganache-cli 是 8545。

在此处输入图像描述

如果单击右侧的设置,请从服务器选项卡更改端口。

在此处输入图像描述

于 2022-01-07T15:16:10.370 回答