![](/img/trans.png)
[英]Solidity - ImportError: cannot import name 'VRFCoordinatorMock' from 'brownie'
[英]solidity - brownie compile - Status 404 getting package version from GitHub
我在想这个问题与版本的版本有关,但是在使用了所有导入包的最后一个版本后,我遇到了同样的问题。
有人可以帮我弄这个吗?
Brownie v1.17.1 - Python development framework for Ethereum
File "C:\Users\ssida\.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\ssida\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\_cli\compile.py", line 50, in main
proj = project.load()
File "C:\Users\ssida\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\main.py", line 751, in load
return Project(name, project_path)
File "C:\Users\ssida\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\main.py", line 183, in __init__ self.load()
File "C:\Users\ssida\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\main.py", line 238, in load
self._compile(changed, self._compiler_config, False)
File "C:\Users\ssida\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\main.py", line 90, in _compile
_install_dependencies(self._path)
File "C:\Users\ssida\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\main.py", line 757, in _install_dependencies
install_package(package_id)
File "C:\Users\ssida\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\main.py", line 779, in install_package
return _install_from_github(package_id)
File "C:\Users\ssida\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\main.py", line 841, in _install_from_github
download_url = _get_download_url_from_tag(org, repo, version, headers)
File "C:\Users\ssida\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\main.py", line 904, in _get_download_url_from_tag
raise ConnectionError(msg)
ConnectionError: Status 404 when getting package versions from Github: 'Not Found'
Missing or forbidden.
If this issue persists, generate a Github API token and store it as the environment variable `GITHUB_TOKEN`:
https://github.blog/2013-05-16-personal-api-tokens/
PS C:\Users\ssida\Documents\GitHub\defi-fullstack-app>
当我午餐 - 布朗尼编译时,我遇到了这个问题。 附上屏幕
编辑
谢谢你的提示-在我的巧克力蛋糕下面。yaml
project_structure:
build: build
contracts: contracts
interfaces: interfaces
reports: reports
scripts: scripts
tests: tests
networks:
default: development
development:
gas_limit: max
gas_buffer: 1
gas_price: 0
max_fee: null
priority_fee: null
reverting_tx_gas_limit: max
default_contract_owner: true
cmd_settings: null
verify: False
ganache:
verify: False
kovan:
verify: True
weth_token: "my address token/"
fau_token: "my address token/"
live:
gas_limit: auto
gas_buffer: 1.1
gas_price: auto
max_fee: null
priority_fee: null
reverting_tx_gas_limit: false
default_contract_owner: false
compiler:
evm_version: null
solc:
version: null
optimizer:
enabled: true
runs: 200
remappings: -'@openzeppelin = OpenZeppelin/openzeppelin-contracts@4.3.2';
vyper:
version: null
console:
show_colors: true
color_style: monokai
auto_suggest: true
completions: true
editing_mode: emacs
reports:
exclude_paths: null
exclude_contracts: null
only_include_project: true
hypothesis:
deadline: null
max_examples: 50
report_multiple_bugs: False
stateful_step_count: 10
phases:
explicit: true
reuse: true
generate: true
target: true
shrink: true
autofetch_sources: false
dependencies:
- OpenZeppelin/openzeppelin-contracts@4.3.2
- smartcontract/chainlink-brownie-contracts@0.2.1
dev_deployment_artifacts: false
已解决已安装的安全智能合约开发库。 建立在经过社区审查的代码的坚实基础之上。
$ npm 安装@openzeppelin/contracts
当我在我的 brownie-config.yaml 中有一个错字时,我多次遇到这个错误......希望这会有所帮助。
我遇到了同样的问题并且无法找到根本原因,但是在新目录中重新制作项目以某种方式为我解决了这个问题。
以前,我曾尝试删除所有依赖项以测试 brownie compile 是否只处理基本合同,但奇怪的是遇到了以下错误:
Brownie v1.17.1 - Python development framework for Ethereum
File "brownie/_cli/__main__.py", line 64, in main
importlib.import_module(f"brownie._cli.{cmd}").main()
File "brownie/_cli/compile.py", line 32, in main
project_path = project.check_for_project(".")
File "brownie/project/main.py", line 548, in check_for_project
structure_config = _load_project_structure_config(folder)
File "brownie/_config.py", line 272, in _load_project_structure_config
data = _load_config(project_path).get("project_structure", {})
AttributeError: 'NoneType' object has no attribute 'get'
希望这会有所帮助,似乎这可能是源于布朗尼的问题。
我尝试按照您的提示进行操作,但现在我遇到了这个问题。 这几天怎么了!!
Loading personal and system profiles took 559ms. PS C:\Users\ssida\Documents\GitHub\defi-app-token> brownie init brownie: The term 'brownie' is not recognized as a name of a cmdlet, function, script file, or executable program.Check the spelling of the name, or if a path was included, verify that the path is correct and try again. PS C:\Users\ssida\Documents\GitHub\defi-app-token> pip install pipx pip: The term 'pip' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. PS C:\Users\ssida\Documents\GitHub\defi-app-token> conda install pip Collecting package metadata (current_repodata.json): done Solving environment: done
# All requested packages already installed.
PS C:\\Users\\ssida\\Documents\\GitHub\\defi-app-token>
powershell 7.2 可能有问题?
PowerShell 7.2.0
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
Loading personal and system profiles took 699ms.
(base) PS C:\Users\ssida\Documents\GitHub\defi-app-token> brownie init
brownie: The term 'brownie' is not recognized as a name of a cmdlet, function, script file, or executable program.Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
(base) PS C:\Users\ssida\Documents\GitHub\defi-app-token>
所以我遇到了同样的问题,修复很简单,我忽略了,我想我会在这里发布给任何可能需要同样简单修复的人:
起初:
dependencies:
-smartcontractkit/chainlink......
固定的:
depedencies:
- smartcontractkit/chainlink......
我只需要在连字符后添加一个空格
我的 brownie-config.yaml 中的一个错误导致了我的问题,我输入了
- smartcontractkit/chainlink-brownie-contract@0.2.1
对我来说,这个问题是由我的 brownie-config.yml 文件中的 openzeppelin 拼写错误引起的,我在 brownie-config 依赖项和重新映射变量中遗漏了 openzeppelin 中的第三个 e。 通过改变固定
openzepplin
至
openzeppelin
在那些变量中。
- smartcontractkit/chainlink-brownie-contracts@1.1.1
- OpenZeppelin/openzeppelin-contracts@3.4.0
compiler:
solc:
remappings:
- '@chainlink=smartcontractkit/chainlink-brownie-contracts@1.1.1'
- '@openzeppelin=OpenZeppelin/openzeppelin-contracts@3.4.0'```
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.