2013-04-10 3 views
1

시작 스크립트를 실행하려고하는데 다음 오류로 끝납니다.Erlang 의존성 시작되지 않음 오류

{"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. 

답변

3

응용 프로그램 시작 순서가 중요합니다. 특히 cowboyranchcrypto에 따라 다릅니다. 또한 public_keycrypto에 의존하므로 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). 

가 시작 종속성 [app]/src/[app].app.src에 나열되어 있습니다. LYSE chapter을 참조하십시오.

EGS는 Cowboy의 마스터 브랜치 (master branch)에 의존하기 때문에 아마도 Ranch를 의존성으로 도입했을 것입니다.

+0

나는 목장을 egs.app.src 파일에 추가 한 다음 egs.erl에서 순서를 재정렬하여 시작되었습니다. 고마워. – mattk