问题布朗尼设置,不确定Ganache是否正确安装了-Chainlink Hackathon
我是这个空间的新手,并且有一个问题让布朗尼运行我的第一个部署脚本。我正在通过Chainlink Hackathon学习,并遵循Patrick Collins的Brownie教程。我认为问题是Ganache。任何帮助将不胜感激。
当我要求Ganache的版本时 - 说找不到(见下文)。当我尝试通过NPM安装时,我收到错误13。这与Mac OS有关吗?
尝试部署脚本时的错误消息:
布朗尼运行脚本/deploy.py
>Brownie v1.18.1 - Python development framework for Ethereum
(base) x:brownie-hack mariposa$ brownie run scripts/deploy.py
Brownie v1.18.1 - Python development framework for Ethereum
BrownieHackProject is the active project.
File "brownie/_cli/__main__.py", line 64, in main
importlib.import_module(f"brownie._cli.{cmd}").main()
File "brownie/_cli/run.py", line 45, in main
network.connect(CONFIG.argv["network"])
File "brownie/network/main.py", line 50, in connect
rpc.launch(active["cmd"], **active["cmd_settings"])
File "brownie/network/rpc/__init__.py", line 75, in launch
self.process = self.backend.launch(cmd, **kwargs)
File "brownie/network/rpc/ganache.py", line 69, in launch
ganache_version = get_ganache_version(cmd_list[0])
File "brownie/network/rpc/ganache.py", line 110, in get_ganache_version
ganache_version_proc = psutil.Popen([ganache_executable, "--version"], stdout=PIPE)
File "psutil/__init__.py", line 1319, in __init__
self.__subproc = subprocess.Popen(*args, **kwargs)
File "//anaconda3/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "//anaconda3/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ganache-cli': 'ganache-cli'
依赖项/版本已安装:
$ node -v
v16.14.2
$ npm -v
8.5.0
$ yarn -v
3.2.0
$ python- version
Python 2.7.10
$ Brownie
布朗尼V1.18.1-以太坊的Python开发框架
ganache -cli-version
bash:ganache-cli:找不到命令
npm install -g ganache-cli
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/ganache-cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ganache-cli'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ganache-cli'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/ganache-cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mariposa/.npm/_logs/2022-04-29T18_59_01_563Z-debug-0.log
(base) x:brownie-hack mariposa$ npm install ganache-cli@latest -g
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/ganache-cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ganache-cli'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ganache-cli'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/ganache-cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mariposa/.npm/_logs/2022-04-29T19_24_54_189Z-debug-0.log
(base) x:brownie-hack mariposa$ ganache-cli --version
$ brownie -network ganache-cli
> Brownie v1.18.1 - Python development framework for Ethereum
> Usage: brownie <command> [<args>...] [options <args>]...
这是由chainlink hackathon提供的部署脚本。视觉工作室代码中突出显示布朗尼的错误消息(“导入“布朗尼”无法解决的塔...”)
from brownie import SimpleStorage, accounts
def main():
account = accounts[0]
simple_storage_contract = SimpleStorage.deploy({"from": account})
print(simple_storage_contract.number())
I am new to this space and having an issue getting brownie to run my first deploy script. I am learning through the Chainlink Hackathon and following the brownie tutorial by Patrick Collins. I think the problem is with ganache. Any help would be appreciated.
When I ask for the version of ganache - it says not found (see below). when I try to install via npm, I receive error no 13. Is this related to Mac OS?
Error message when trying to deploy script:
brownie run scripts/deploy.py
>Brownie v1.18.1 - Python development framework for Ethereum
(base) x:brownie-hack mariposa$ brownie run scripts/deploy.py
Brownie v1.18.1 - Python development framework for Ethereum
BrownieHackProject is the active project.
File "brownie/_cli/__main__.py", line 64, in main
importlib.import_module(f"brownie._cli.{cmd}").main()
File "brownie/_cli/run.py", line 45, in main
network.connect(CONFIG.argv["network"])
File "brownie/network/main.py", line 50, in connect
rpc.launch(active["cmd"], **active["cmd_settings"])
File "brownie/network/rpc/__init__.py", line 75, in launch
self.process = self.backend.launch(cmd, **kwargs)
File "brownie/network/rpc/ganache.py", line 69, in launch
ganache_version = get_ganache_version(cmd_list[0])
File "brownie/network/rpc/ganache.py", line 110, in get_ganache_version
ganache_version_proc = psutil.Popen([ganache_executable, "--version"], stdout=PIPE)
File "psutil/__init__.py", line 1319, in __init__
self.__subproc = subprocess.Popen(*args, **kwargs)
File "//anaconda3/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "//anaconda3/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ganache-cli': 'ganache-cli'
Dependencies /versions installed:
$ node -v
v16.14.2
$ npm -v
8.5.0
$ yarn -v
3.2.0
$ python --version
Python 2.7.10
$ brownie
Brownie v1.18.1 - Python development framework for Ethereum
ganache-cli --version
bash: ganache-cli: command not found
npm install -g ganache-cli
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/ganache-cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ganache-cli'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ganache-cli'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/ganache-cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mariposa/.npm/_logs/2022-04-29T18_59_01_563Z-debug-0.log
(base) x:brownie-hack mariposa$ npm install ganache-cli@latest -g
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/ganache-cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ganache-cli'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ganache-cli'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/ganache-cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mariposa/.npm/_logs/2022-04-29T19_24_54_189Z-debug-0.log
(base) x:brownie-hack mariposa$ ganache-cli --version
$brownie --network ganache-cli
> Brownie v1.18.1 - Python development framework for Ethereum
> Usage: brownie <command> [<args>...] [options <args>]...
This is the deploy script provided by chainlink hackathon. Error message in visual studio code that highlights brownie ("Import "brownie" could not be resolved pylance...")
from brownie import SimpleStorage, accounts
def main():
account = accounts[0]
simple_storage_contract = SimpleStorage.deploy({"from": account})
print(simple_storage_contract.number())
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

该错误实际上与Ganache无关(Ganache被卡在那里发生的事实;这意味着它在该IP地址和端口上运行)。
发生的事情是,您在第8行中的
decloy.py
文件中有一个语法错误。它说您有simple.storage
当您想要的是simple> simple> simple_storage
(使用下划线而不是该期间)。确保修复脚本中的第8行并保存文件。The error isn't actually to do with Ganache (the fact that Ganache gets stuck there is supposed to happen; that means it is running at that IP address and port).
What is happening is you have a syntax error in your
deploy.py
file at line 8. It is saying you havesimple.storage
when what you want issimple_storage
(with the underscore instead of the period). Make sure you fix line 8 in the script and save the file.