【问题标题】:Our phoenix app failed to start due to telemetry由于遥测,我们的 phoenix 应用程序无法启动
【发布时间】:2023-03-10 01:22:01
【问题描述】:

我们的团队正在开发 Phoenix 项目,本周有一位新成员加入了我们。他尝试在 Ubuntu 20.04 机器上的 Docker 环境中工作。

他从我们的 GitHub repo 中提取了源代码,发现我们的应用无法启动并出现以下错误消息:

[error] beam/beam_load.c(1883): Error loading module telemetry_app:
  This BEAM file was compiled for a later version of the run-time system than 22.
  To fix this, please recompile this module with an 22 compiler.
  (Use of opcode 169; this emulator supports only up to 168.)

[info]  Application telemetry exited: exited in: :telemetry_app.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function :telemetry_app.start/2 is undefined (module :telemetry_app is not available)
            (telemetry 0.4.2) :telemetry_app.start(:normal, [])
            (kernel 6.5.2.1) application_master.erl:277: :application_master.start_it_old/4

他的mix hex.info 输出在这里:

Hex:    0.20.5
Elixir: 1.10.3
OTP:    22.3.4.2

Built with: Elixir 1.10.0 and OTP 21.3

除了他,我们继续照常工作。我们该如何帮助他?

我们发现了一个可能的罪魁祸首:ElixirLS,一个 Visual Studio Code 插件。

除了他,我们的团队成员使用的不是 VSCode 的文本编辑器。

当他从 VSCode 卸载这个插件时,一切顺利。

我不知道这个问题的根本原因是什么,但是我想这个插件在Docker环境之外编译了我们项目的依赖项,导致版本不匹配。

他试图通过docker-compose up -d app启动我们的应用程序。

docker-compose.ymlcommand部分指定的命令是:

elixir --cookie xyz --sname xyz@app
      --erl "-kernel inet_dist_listen_min 6000 inet_dist_listen_max 6100" -S mix phx.server

【问题讨论】:

  • 您已经复制粘贴了两次 :) 此外,还需要更多诊断。 1)通过菜单ViewOutput然后下拉选择→ElixirLS检查输出。请同时分享存储已编译 BEAM 的混合项目设置。另外,请说明他是如何尝试运行该应用程序的; “我们的应用程序无法启动”的描述过于模糊。如果mix run 或类似失败,它可能与选择的编辑器几乎没有任何共同之处。
  • 您不必每次进行更改时都添加Editsite history 跟踪修订并显示已更改的内容。手动添加 [EDIT} 只会使帖子变得杂乱无章。
  • 您介意让他将 local(非 dockerized)OTP 升级到 22 吗? 内置:Elixir 1.10.0 和 OTP 21.3 看起来很可疑。
  • elixir --version 在他的环境中的输出是Erlang/OTP 23 [erts-11.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] Elixir 1.10.4 (compiled with Erlang/OTP 21)。他似乎使用最新的 OTP。无论如何,我们不想让他降级或升级他的 OTP。

标签: elixir phoenix-framework telemetry


【解决方案1】:

我已经删除了 ElixirLS 扩展文件,然后混合运行,一切正常,我不知道原因,但我想使用 ElixirLS:Elixir 支持和调试器。

【讨论】:

  • 是的,每次我删除扩展文件时,它都会正常工作,所以最后我删除了 Elixir 支持和调试器插件
  • 我安装了 VSCode,但没有安装 ElixerLS 插件。但是我得到了同样的错误:(UndefinedFunctionError) function :telemetry_app.start/2 is undefined (module :telemetry_app is not available)我目前没有使用 VSCode 进行开发,我怀疑 VSCode 对我来说是这个错误的根源。
【解决方案2】:

在我的例子中,我需要在 erlang 降级后清除以前构建的 elixer 文件。

我的应用程序在 mix ecto.setup 步骤上也失败了,出现了同样的错误:

 ** (UndefinedFunctionError) function :telemetry_app.start/2 is undefined (module :telemetry_app is not available)

但与 OP 不同的是,我没有使用 VSCode 插件。

就我而言,我已经降级了 Erlang 版本,但没有清除之前构建的文件。

我也看到了这个错误:

10:49:07.305 [error] beam/beam_load.c(1883): Error loading module telemetry_app:
This BEAM file was compiled for a later version of the run-time system than 22.
To fix this, please recompile this module with an 22 compiler.
(Use of opcode 169; this emulator supports only up to 168.)

This elixerforum post 告诉我我需要做什么。我需要清除那些以前构建的 erlang/elixer 文件:

降级Erlang版本时,必须运行

rm -rf deps/ _build/

在您的项目根目录中

【讨论】:

    猜你喜欢
    • 2011-08-22
    • 1970-01-01
    • 2019-12-19
    • 2022-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多