4

Our team is developing a Phoenix project and this week a new member joined us. He tries to work in a Docker environment on the Ubuntu 20.04 box.

He pulled the source code from our GitHub repo and found that our app failed to start with this error message:

[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

His output of mix hex.info is here:

Hex:    0.20.5
Elixir: 1.10.3
OTP:    22.3.4.2

Built with: Elixir 1.10.0 and OTP 21.3

We, except him, continue to work as usual. How can we help him?

We found a possible culprit: ElixirLS, a plugin for Visual Studio Code.

Other than him, our team members use text editors other than VSCode.

When he uninstall this plugin from VSCode, everything went well.

I don't know what is the root cause of this problem, but I suppose that this plugin compiles the dependencies of our project outside the Docker environment so that version mismatch occurs.

He tried to start our app by docker-compose up -d app.

The command specified in the command section in the docker-compose.yml is:

elixir --cookie xyz --sname xyz@app
      --erl "-kernel inet_dist_listen_min 6000 inet_dist_listen_max 6100" -S mix phx.server
Ken White
  • 123,280
  • 14
  • 225
  • 444
Tsutomu
  • 4,848
  • 1
  • 46
  • 68
  • 1
    You have copy-pasted it twice :) Also, more diagnostics are required. 1) Through a menu `View`→`Output` and then dropdown select → `ElixirLS` check the output. Please as well share the mix project settings of where to store compiled BEAMs. Also, please specify how has he tried to run the app; the description “our app failed to start” is too vague. If `mix run` or like failed, it barely might have anything in common with the editor of choice. – Aleksei Matiushkin Aug 06 '20 at 02:46
  • 1
    You don't have to add [EDIT] every time you make a change. The [site history](https://stackoverflow.com/posts/63274985/revisions) keeps track of revisions and shows what has changed. Adding [EDIT} manually just clutters the post with unnecessary noise. – Ken White Aug 06 '20 at 02:51
  • Would you mind to ask him to upgrade _local_ (not dockerized) OTP to 22? _Built with: Elixir 1.10.0 and OTP 21.3_ looks suspicious. – Aleksei Matiushkin Aug 06 '20 at 03:00
  • The output of `elixir --version` on his environment is `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)`. He seems to use the latest OTP. Anyway, we don't want make him downgrade or upgrade his OTP. – Tsutomu Aug 06 '20 at 03:27

2 Answers2

2

I have deleted the ElixirLS extension files, and mix run, everything work fine, I don't know the reason, but I want to use ElixirLS: Elixir support and debugger.

  • Yes, every time when I delete extension files, it will work well, so at the end I removed Elixir support and debugger plugin – Custer Jesse Aug 17 '20 at 14:21
  • I have VSCode installled, but not the ElixerLS plugin. But I get the same error: `(UndefinedFunctionError) function :telemetry_app.start/2 is undefined (module :telemetry_app is not available)` I am not using VSCode for development currently, and I doubt VSCode is the source of this error for me. – Josiah Yoder Mar 26 '22 at 15:45
0

In my case, I needed to clear out previously-built elixer files after an erlang downgrade.

My app also failed on the mix ecto.setup step with the same error:

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

But unlike the OP, I was not using the VSCode plugin.

In my case, I had downgraded the Erlang version but not cleared out the previously-built files.

I was also seeing this error:

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 told me what I needed to do instead. I needed to clear out those previously-built erlang/elixer files:

When downgrading Erlang versions, you must run

rm -rf deps/ _build/

within your project root

Josiah Yoder
  • 3,321
  • 4
  • 40
  • 58