首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >elixir -加载模块时出错ranch_server -使用20编译器重新编译此模块

elixir -加载模块时出错ranch_server -使用20编译器重新编译此模块
EN

Stack Overflow用户
提问于 2019-10-28 06:56:24
回答 1查看 874关注 0票数 0

我正在尝试运行一个现有的灵丹妙药项目,它可以在我的另一台计算机上运行,也可以在一台新计算机上运行(这两台计算机都是mac)。

当我运行iex -S mix时,我得到:

代码语言:javascript
复制
iex -S mix
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]


11:47:52.651 [error] Loading of /Users/benjamin/vepo/api/_build/dev/lib/ranch/ebin/ranch_server.beam failed: :badfile


11:47:52.651 [error] beam/beam_load.c(1863): Error loading module ranch_server:
  This BEAM file was compiled for a later version of the run-time system than 20.
  To fix this, please recompile this module with an 20 compiler.
  (Use of opcode 164; this emulator supports only up to 159.)



11:47:52.657 [info]  Application ranch exited: :ranch_app.start(:normal, []) returned an error: shutdown: failed to start child: :ranch_server
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function :ranch_server.start_link/0 is undefined (module :ranch_server is not available)
            (ranch) :ranch_server.start_link()
            (stdlib) supervisor.erl:365: :supervisor.do_start_child/2
            (stdlib) supervisor.erl:348: :supervisor.start_children/3
            (stdlib) supervisor.erl:314: :supervisor.init_children/2
            (stdlib) gen_server.erl:365: :gen_server.init_it/2
            (stdlib) gen_server.erl:333: :gen_server.init_it/6
            (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
** (Mix) Could not start application ranch: :ranch_app.start(:normal, []) returned an error: shutdown: failed to start child: :ranch_server
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function :ranch_server.start_link/0 is undefined (module :ranch_server is not available)
            (ranch) :ranch_server.start_link()
            (stdlib) supervisor.erl:365: :supervisor.do_start_child/2
            (stdlib) supervisor.erl:348: :supervisor.start_children/3
            (stdlib) supervisor.erl:314: :supervisor.init_children/2
            (stdlib) gen_server.erl:365: :gen_server.init_it/2
            (stdlib) gen_server.erl:333: :gen_server.init_it/6
            (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Benjamins-MacBook-Pro:api benjamin$

我想我需要重新编译ranch_server.beam。我该怎么做?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-28 08:27:51

看起来您需要安装Erlang 21.0或更高版本。您当前运行的是版本20。计算机上运行的版本是什么?

ASDF对于在同一台机器上管理多个版本的erlang非常有用。

或者,如果只想重新编译依赖项,可以尝试

代码语言:javascript
复制
mix do deps.clean ranch_server, deps.get, deps.compile
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58584062

复制
相关文章

相似问题

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