【发布时间】: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.yml中command部分指定的命令是:
elixir --cookie xyz --sname xyz@app
--erl "-kernel inet_dist_listen_min 6000 inet_dist_listen_max 6100" -S mix phx.server
【问题讨论】:
-
您已经复制粘贴了两次 :) 此外,还需要更多诊断。 1)通过菜单
View→Output然后下拉选择→ElixirLS检查输出。请同时分享存储已编译 BEAM 的混合项目设置。另外,请说明他是如何尝试运行该应用程序的; “我们的应用程序无法启动”的描述过于模糊。如果mix run或类似失败,它可能与选择的编辑器几乎没有任何共同之处。 -
您不必每次进行更改时都添加Edit。 site 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