【问题标题】:How do I recompile rebar3 with an Erlang/OTP 25 compiler? Running Elixir 1.13.4如何使用 Erlang/OTP 25 编译器重新编译 rebar3?运行 Elixir 1.13.4
【发布时间】:2022-08-15 19:06:01
【问题描述】:

我正在关注Phoenix LiveView Starter 中的免费截屏视频/教程 但我什至无法开始,因为mix setup 失败了:

=ERROR REPORT==== 6-Jul-2022::12:47:58.702361 ===
beam/beam_load.c(551): Error loading function rebar3:parse_args/1: op put_tuple u x:
  please re-compile this module with an Erlang/OTP 25 compiler


escript: exception error: undefined function rebar3:main/1
  in function  escript:run/2 (escript.erl, line 750)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1
  in call from init:do_boot/3
** (Mix) Could not compile dependency :telemetry, \"/Users/martinstabenfeldt/.mix/rebar3 bare compile --paths /Users/martinstabenfeldt/Work/pragmaticstudio.com-liveview-starter/code-bundle/live_view_studio/_build/dev/lib/*/ebin\" command failed. Errors may have been logged above. You can recompile this dependency with \"mix deps.compile telemetry\", update it with \"mix deps.update telemetry\" or clean it with \"mix deps.clean telemetry\"
$ elixir --version
Erlang/OTP 25 [erts-13.0.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns] [dtrace]

Elixir 1.13.4 (compiled with Erlang/OTP 24)

我的 mix.exs 部门看起来像这样:

  defp deps do
    [
      {:phoenix, \"~> 1.5.13\"},
      {:phoenix_ecto, \"~> 4.4\"},
      {:ecto_sql, \"~> 3.4\"},
      {:postgrex, \">= 0.0.0\"},
      {:phoenix_live_view, \"~> 0.16.4\"},
      {:floki, \">= 0.30.0\", only: :test},
      {:phoenix_html, \"~> 3.0.4\"},
      {:phoenix_live_reload, \"~> 1.2\", only: :dev},
      {:phoenix_live_dashboard, \"~> 0.4\"},
      {:telemetry_metrics, \"~> 0.6\"},
      {:telemetry_poller, \"~> 1.0\"},
      {:gettext, \"~> 0.11\"},
      {:jason, \"~> 1.0\"},
      {:plug_cowboy, \"~> 2.0\"},
      {:faker, \"~> 0.17.0\"},
      {:number, \"~> 1.0\"}
    ]
  end

我不确定如何使用 OTP 25 编译器重新编译。 我正在运行 Elixir 1.13.4。它是用 OTP 24 编译的。不确定这是否与它有关? 我也试过 mix local-rebar --forcemix deps.update telemetry 没有任何运气。

    标签: elixir rebar3


    【解决方案1】:

    如果你仔细检查elixir --version 提示,你会发现:

    Elixir 1.13.4 (compiled with Erlang/OTP 24)
    

    假设您使用asdf 作为版本管理器,请确保您安装了正确的 版本:

    $ asdf list all elixir
    ...
    1.13.4
    1.13.4-otp-22
    1.13.4-otp-23
    1.13.4-otp-24
    1.13.4-otp-25
    ...
    

    你需要那个,用OTP25编译,意思是

    $ asdf install elixir 1.13.4-otp-25
    $ asdf global elixir 1.13.4-otp-25
    

    会做。

    【讨论】:

    • 谢谢,这有效!我还做了一个brew uninstall elixir
    • 如果是第一次安装 asdf,也可能需要 asdf plugin add elixir
    • 此外,在 macOS 上,需要将“export PATH=~/.asdf/shims:$PATH”添加到“/.zshrc”中
    【解决方案2】:

    我反而降级了自制的 erlang 包:

    $ brew uninstall --ignore-dependencies erlang
    $ brew install erlang@24
    $ PATH="/opt/homebrew/opt/erlang@24/bin:$PATH"
    $ elixir --version
    Erlang/OTP 24 [erts-12.3.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [dtrace]
    
    Elixir 1.13.4 (compiled with Erlang/OTP 24)
    

    【讨论】:

      猜你喜欢
      • 2022-09-28
      • 2014-10-14
      • 2019-01-27
      • 2023-04-02
      • 2020-02-23
      • 2014-06-22
      • 2018-08-31
      • 2012-03-06
      • 2013-07-10
      相关资源
      最近更新 更多