首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >escript:异常错误:不匹配右侧值{error,enoent}‏

escript:异常错误:不匹配右侧值{error,enoent}‏
EN

Stack Overflow用户
提问于 2014-01-17 10:09:06
回答 1查看 5.7K关注 0票数 4

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

代码语言:javascript
复制
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/S739wfhB上发布了完整的错误,generate_deps的完整代码可以在这里找到- http://pastebin.com/N4HVz8z1

Ps。我也尝试过使用CYGWIN,但它返回另一个错误-转录:未能打开文件: /home/Fujitsu/rabbitmq/build-source/rabbitmq-public-umbrella/generate_deps

编辑1

CYGWIN返回:

代码语言:javascript
复制
$ 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命令打开文件。

代码语言:javascript
复制
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)],
EN

回答 1

Stack Overflow用户

发布于 2014-01-17 11:31:00

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

代码语言:javascript
复制
{ok, Hdl} = file:open(TargetFile, [write, delayed_write]),

尝试打开文件并在{ok, Hld}上进行匹配的地方。但是,file:open在找不到文件时返回{error,enoent},这将导致匹配失败并生成erlang错误。

编辑:

在我看来,问题在于它试图编写的文件。你可以在那个目录里写字吗?如果文件已经存在,是否允许打开它以进行写入?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21183115

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档