gpt4 book ai didi

Erlang 依赖项未启动错误

转载 作者:行者123 更新时间:2023-12-04 00:43:27 35 4
gpt4 key购买 nike

我正在尝试运行启动脚本,但最终出现以下错误。

{"init terminating in do_boot",{{case_clause,{error,{not_started,ranch}}},[{egs,ensure_started,1,[{file,"src/egs.erl"},{line,84}]},{egs,start,0,[{file,"src/egs.erl"},{line,49}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

我可以用多个依赖项编译整个文件夹,这是唯一一个有错误的。我使用“make”进行编译,它应该是“make run”来运行,但它不起作用。这就是我收到此错误的原因吗?任何关于如何修复它的想法将不胜感激。

我从中得到错误的文件如下。

-module(egs).
-export([start/0, stop/0, global/1, warp/4, warp/5]). %% API.

%% Player and account-related types.

-type gid() :: 0..16#ffffffff.
-type lid() :: 0..1023 | 16#ffff.
-type character_slot() :: 0..3.
-export_type([gid/0, lid/0, character_slot/0]).

%% Location related types.

-type uniid() :: 21 | 26..254 | 16#ffffffff.
-type questid() :: 0..16#ffffffff. %% @todo What's the real max?
-type zoneid() :: 0..16#ffff. %% @todo What's the real max?
-type mapid() :: 0..9999.
-type entryid() :: 0..16#ffff. %% @todo What's the real max?
-type area() :: {questid(), zoneid(), mapid()}. %% @todo Probably remove later.
-type position() :: {X::float(), Y::float(), Z::float(), Dir::float()}.
-export_type([uniid/0, questid/0, zoneid/0, mapid/0, entryid/0,
area/0, position/0]).

%% API.

-spec start() -> ok.
start() ->
ensure_started(crypto),
ensure_started(public_key),
ensure_started(ssl),
ensure_started(cowboy),
ensure_started(ranch),
application:start(egs).

-spec stop() -> ok.
stop() ->
Res = application:stop(egs),
ok = application:stop(cowboy),
ok = application:stop(ranch),
ok = application:stop(ssl),
ok = application:stop(public_key),
ok = application:stop(crypto),
Res.

%% @doc Send a global message.
-spec global(string()) -> ok.
global(Message) when length(Message) > 511 ->
io:format("global: message too long~n");
global(Message) ->
egs_users:broadcast_all({egs, notice, top, Message}).

%% @doc Warp all players to a new map.
-spec warp(questid(), zoneid(), mapid(), entryid()) -> ok.
warp(QuestID, ZoneID, MapID, EntryID) ->
egs_users:broadcast_all({egs, warp, QuestID, ZoneID, MapID, EntryID}).

%% @doc Warp one player to a new map.
-spec warp(gid(), questid(), zoneid(), mapid(), entryid()) -> ok.
warp(GID, QuestID, ZoneID, MapID, EntryID) ->
egs_users:broadcast({egs, warp, QuestID, ZoneID, MapID, EntryID}, [GID]).

%% Internal.

-spec ensure_started(module()) -> ok.
ensure_started(App) ->
case application:start(App) of
ok -> ok;
{error, {already_started, App}} -> ok
end.

最佳答案

应用程序启动的顺序很重要。特别是,cowboy 依赖于 ranchcrypto。此外,public_key 依赖于 crypto,并且必须在 ssl 之前启动。正确的开始顺序是:

ok = application:start(crypto),
ok = application:start(public_key),
ok = application:start(ssl),
ok = application:start(ranch),
ok = application:start(cowboy),
ok = application:start(egs).

对于使用 Rebar 构建的应用程序,启动依赖项列在 [app]/src/[app].app.src 中。查看LYSE chapter .

它不能开箱即用的原因可能是 EGS 依赖于 Cowboy 的 master 分支,该分支最近引入了 Ranch 作为依赖项。

关于Erlang 依赖项未启动错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15915564/

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