gpt4 book ai didi

Erlang escript : exception error: no match of right hand side value {error, enoent}‏

转载 作者:行者123 更新时间:2023-12-02 01:05:38 34 4
gpt4 key购买 nike

我在 Windows 7(64 位)上尝试使用 MinGW/MSYS 构建 Erlang RabbitMQ 插件时遇到了上述错误。我正在使用 Erlang v5.10.3(32 位)。我能够在我的系统上运行 RabbitMQ。

Fujitsu@Notebook /d/RabbitMQ/build-source/rabbitmq-public-umbrella/presence-exchange-master
$ make
[elided] generate deps
escript: exception error: no match of right hand side value {error,enoent}
in function generate_deps__escript__1389__793192__493000:detect_deps/5 (d:/RabbitMQ/build-source/rabbitmq-public-umbrella/generate_deps, line 40)
in call from generate_deps__escript__1389__793192__493000:'-main/1-fun-0-'/6 (d:/RabbitMQ/build-source/rabbitmq-public-umbrella/generate_deps, line 19)
in call from lists:foldl/3 (lists.erl, line 1248)
in call from generate_deps__escript__1389__793192__493000:main/1 (d:/RabbitMQ/build-source/rabbitmq-public-umbrella/generate_deps, line 17)
in call from escript:run/2 (escript.erl, line 747)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_it/1 (init.erl, line 1054)
in call from init:start_em/1 (init.erl, line 1034)

我已经在pastebin上发布了完整的错误 - http://pastebin.com/S739wfhBgenerate_deps 的完整代码可以在这里找到 - http://pastebin.com/N4HVz8z1

诗。我也尝试过使用 CYGWIN,但它返回另一个错误 - escript: 无法打开文件:/home/Fujitsu/rabbitmq/build-source/rabbitmq-public-umbrella/generate_deps

编辑 1

CYGWIN 返回:

$ make
[elided] generate deps
escript: Failed to open file: /cygdrive/d/RabbitMQ/build-source/rabbitmq-public-umbrella/generate_deps
[elided] generate deps
escript: Failed to open file: /cygdrive/d/RabbitMQ/build-source/rabbitmq-public-umbrella/generate_deps
make: *** No rule to make target 'build/deps.mk', needed by 'ebin/presence_exchange.beam'. Stop.

但是,我可以使用 head 命令打开该文件。

Fujitsu@Notebook /cygdrive/d/RabbitMQ/build-source/rabbitmq-public-umbrella/presence-exchange-master
$ head /cygdrive/d/RabbitMQ/build-source/rabbitmq-public-umbrella/generate_deps
#!/usr/bin/env escript
%% -*- erlang -*-
-mode(compile).

%% We expect the list of Erlang source and header files to arrive on
%% stdin, with the entries colon-separated.
main([TargetFile, EbinDir]) ->
ErlsAndHrls = [ string:strip(S,left) ||
S <- string:tokens(io:get_line(""), ":\n")],
ErlFiles = [F || F <- ErlsAndHrls, lists:suffix(".erl", F)],

最佳答案

这很可能是因为它找不到您尝试打开的文件,这就是 POSIX enoent 错误的含义。当你使用cygwin时,它就更明确了。 erlang badmatch 错误来自第 23 行:

{ok, Hdl} = file:open(TargetFile, [write, delayed_write]),

您尝试打开文件并匹配{ok, Hld}。但是当找不到文件时,file:open会返回{error,enoent},从而导致匹配失败并生成erlang错误。

编辑:

据我所知,问题在于它试图写入的文件。您可以在该目录中写入吗?如果文件已经存在,您是否可以打开它进行写入?

关于Erlang escript : exception error: no match of right hand side value {error, enoent}‏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21183115/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com