Contract-Development

布朗尼找不到 deploy.py 腳本

  • January 18, 2022

我已經在我的系統(Windows)上安裝了 python 和 Anaconda,這可能是我之前學習的課程,這可能是問題的根本原因。我正處於需要執行deploy.py腳本來部署契約的階段,但找不到文件並且沒有任何反應。

每次我執行 brownie 時,我都會首先收到一條資訊說明:

INFO: Could not find files for the given pattern(s).

然後,Brownie 執行、編譯契約等,我得到了大量與 ganache 文件有關的文本。最後,我得到一個FileNotFoundError說系統找不到我要執行的文件。下面的程式碼:

PS C:\Users\nstei\Git Repos\my-frist-brownie-project> brownie run .\scripts\deploy.py
INFO: Could not find files for the given pattern(s).  
Brownie v1.14.6 - Python development framework for Ethereum

Compiling contracts...  
 Solc version: 0.7.3  
 Optimizer: Enabled  Runs: 200  
 EVM Version: Istanbul  
Generating build data...  
- MyFirstContract  

MyFristBrownieProject is the active project.

Launching 'ganache-cli.cmd --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...  
 File "c:\users\nstei\.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\nstei\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\_cli\run.py", line 43, in main
   network.connect(CONFIG.argv["network"])  
 File "c:\users\nstei\.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\nstei\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\__init__.py", line 77, in launch
   self.process = self.backend.launch(cmd, **kwargs)  
 File "c:\users\nstei\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py", line 73, in launch
   return psutil.Popen(cmd_list, stdin=DEVNULL, stdout=out, stderr=out)  
 File "c:\users\nstei\.local\pipx\venvs\eth-brownie\lib\site-packages\psutil\__init__.py", line 1312, in __init__
   self.__subproc = subprocess.Popen(*args, **kwargs)  
 File "C:\Python39\lib\subprocess.py", line 951, in __init__
   self._execute_child(args, executable, preexec_fn, close_fds,  
 File "C:\Python39\lib\subprocess.py", line 1420, in _execute_child
   hp, ht, pid, tid = _winapi.CreateProcess(executable, args,  
FileNotFoundError: [WinError 2] The system cannot find the file specified

很難找到甘納許。您需要安裝nodejs 和 npm,然後執行以下命令:

npm install -g ganache-cli

你應該很高興

我在 Windows 20H2 上遇到了同樣的問題,我嘗試使用 npm install -g ganache-cli 但對我不起作用,解除安裝並重新安裝了很多次。在那之後,我檢查了我的節點版本是 12.xx,這就是問題所在。我已將其升級到 14.18.0,現在巧克力蛋糕適合我。 https://nodejs.org/en/

引用自:https://ethereum.stackexchange.com/questions/103489