Rebar3 无法下载对 Windows 10 的依赖
Posted
技术标签:
【中文标题】Rebar3 无法下载对 Windows 10 的依赖【英文标题】:Rebar3 is unable to download dependency on Windows 10 【发布时间】:2021-07-21 09:30:50 【问题描述】:我只是从 otp 和 rebar3 开始。以下是安装的版本:
二郎/OTP 23
Erlang/OTP 23 Erts 11.2 上的 rebar 3.15.1
但是,当我尝试从 rebar3 的 Basic Usage 页面添加依赖项 cowboy
时,编译失败并出现以下错误:
❯ rebar3 compile
===> Verifying dependencies...
===> Fetching cowboy v1.0.1
===> Failed to fetch and copy dep: pkg,<<"cowboy">>,<<"1.0.1">>,
<<"810EFE0B51CBBB97B175E605A520963452990B6568F93306B4FE88955D40FE94">>,
<<"CF7F0969870EBAA68F6E176A1A9559BEC23FBB4B61988C9DECD7DF38D827C5A9">>,
#api_key => undefined,
api_organization => undefined,
api_url => <<"https://hex.pm/api">>,
http_adapter =>
r3_hex_http_httpc,#profile => rebar,
http_etag => undefined,http_headers => #,
http_user_agent_fragment =>
<<"(rebar3/3.15.1) (httpc)">>,
name => <<"hexpm">>,repo_key => undefined,
repo_organization => undefined,
repo_public_key =>
<<"-----BEGIN PUBLIC KEY-----\nPUBLICK-KEY-HERE\n-----END PUBLIC KEY-----">>,
repo_verify => true,
repo_verify_origin => true,
tarball_max_size => 8388608,
tarball_max_uncompressed_size => 67108864
为方便起见,下面是使用命令rebar3 report compile
生成的rebar3 报告:
❯ rebar3 report compile
Rebar3 report
version 3.15.1
generated at 2021-04-28T02:55:18+00:00
=================
Please submit this along with your issue at https://github.com/erlang/rebar3/issues (and feel free to edit out private information, if any)
-----------------
Task: compile
Entered as:
compile
-----------------
Operating System: win32
ERTS: Erlang/OTP 23 [erts-11.2] [source] [smp:8:8] [ds:8:8:10] [async-threads:1]
Root Directory: c:/Program Files (x86)/erl-23.3
Library directory: c:/Program Files (x86)/erl-23.3/lib
-----------------
Loaded Applications:
bbmustache: 1.10.0
certifi: 2.5.3
cf: 0.3.1
common_test: 1.20
compiler: 7.6.7
crypto: 4.9
cth_readable: 1.5.1
dialyzer: 4.3.1
edoc: 0.12
erlware_commons: 1.4.0
eunit: 2.6
eunit_formatters: 0.5.0
getopt: 1.0.1
hipe: 4.0.1
inets: 7.3.2
kernel: 7.3
providers: 1.8.1
public_key: 1.10
relx: 4.4.0
sasl: 4.0.2
snmp: 5.8
ssl_verify_fun: 1.1.6
stdlib: 3.14.1
syntax_tools: 2.5
tools: 3.4.4
-----------------
Escript path: c:/tools/rebar3/rebar3
Providers:
app_discovery as clean compile compile cover ct deps dialyzer do edoc escriptize eunit get-deps help install install_deps list lock new path pkgs release relup report repos shell state tar tree unlock update upgrade upgrade upgrade version xref
我的rebar3.config
文件:
erl_opts, [debug_info].
deps, [
cowboy, "1.0.1", % package
cowboy, git, "git://github.com/ninenines/cowboy.git", tag, "1.0.1" % alternatively, source
].
shell, [
% config, "config/sys.config",
apps, [myapp]
].
我尝试从十六进制下载不同的依赖项,例如 libp2p
,但出现相同的错误。
任何帮助将不胜感激。谢谢。
【问题讨论】:
【参考方案1】:尝试使用:
deps, [
cowboy, git, "git://github.com/ninenines/cowboy.git", tag, "1.0.1"
].
或
deps, [
cowboy, "1.0.1"
].
不要同时尝试两种不同的方法来获取依赖项。
P.S. cowboy, "1.0.1"
版本太旧,OTP 23
可能不支持。尝试使用最新版本2.8.0
。
【讨论】:
以上是关于Rebar3 无法下载对 Windows 10 的依赖的主要内容,如果未能解决你的问题,请参考以下文章
Rebar3 版本无法运行并崩溃,无法在引导文件中扩展 $ERTS_LIB_DIR