当 运行 Elixir container bootstrap 我得到 Error loading module pooler_app 时,我该如何解决?

When running Elixir container bootstrap I get Error loading module pooler_app, how can I solve that?

我是 运行 一个带有 Elixir 应用程序的容器,但是当我尝试制作一个 bootstrap 时,我收到以下错误:

12:49:59.687 [error] beam/beam_load.c(1863): Error loading module pooler_app: 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.)

12:49:59.707 [info] Application pooler exited: exited in: :pooler_app.start(:normal, []) ** (EXIT) an exception was raised: ** (UndefinedFunctionError) function :pooler_app.start/2 is undefined (module :pooler_app is not available) (pooler) :pooler_app.start(:normal, []) (kernel) application_master.erl:273: :application_master.start_it_old/4 ** (ArgumentError) argument error (stdlib) :ets.lookup(:cqerl_clusters, :system) (cqerl) /mnt/svcs/lukla/deps/cqerl/src/cqerl_cluster.erl:52: :cqerl_cluster.get_any_client/1 lib/cassandra.ex:50: Lukla.Cassandra.new_client/1 lib/cassandra.ex:11: Lukla.Cassandra.new!/1 lib/mix/tasks/cassandra.drop.ex:16: Mix.Tasks.Cassandra.Drop.run/1 (mix) lib/mix/task.ex:314: Mix.Task.run_task/3 (elixir) lib/enum.ex:737: Enum."-each/2-lists^foreach/1-0-"/2 (elixir) lib/enum.ex:737: Enum.each/2

我尝试更改 Elixir 版本和 Erlang 版本,但错误仍然存​​在。

我正在使用 asdf Elixir 1.6.5 和 Erlang 20.0。

编辑

我删除了 _build 文件夹,现在当我再次尝试 bootstrap 时,出现以下错误:

14:17:44.539 [error] Loading of /mnt/svcs/lukla/_build/dev/lib/re2/ebin/re2.beam failed: :badfile

14:17:44.539 [error] beam/beam_load.c(1863): Error loading module re2: 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.)

** (exit) exited in: :gen_fsm.sync_send_event(#PID<0.360.0>, {:send_query, #Reference<0.2121126444.1751646212.63871>, {:cql_query, "DROP KEYSPACE IF EXISTS lukla_dev;", [], :undefined, false, 100, :undefined, :one, :undefined, :undefined}}, 5000) ** (EXIT) an exception was raised: ** (UndefinedFunctionError) function :re2.compile/1 is undefined (module :re2 is not available) (re2) :re2.compile('\'(\?|:\w+)\'(?:(?:[^"]"[^"]")[^"]$)') (cqerl) /mnt/svcs/lukla/deps/cqerl/src/cqerl_cache.erl:58: :cqerl_cache.lookup/2 (cqerl) /mnt/svcs/lukla/deps/cqerl/src/cqerl_client.erl:244: :cqerl_client.live/3 (stdlib) gen_fsm.erl:483: :gen_fsm.handle_msg/8 (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3 (stdlib) gen_fsm.erl:252: :gen_fsm.sync_send_event/3 (cqerl) /mnt/svcs/lukla/deps/cqerl/src/cqerl.erl:196: :cqerl.run_query/3 lib/cqex/query.ex:62: CQEx.Query.call/2 lib/cqex/query.ex:75: CQEx.Query.call!/2 lib/mix/tasks/cassandra.drop.ex:18: Mix.Tasks.Cassandra.Drop.run/1 (mix) lib/mix/task.ex:314: Mix.Task.run_task/3 (elixir) lib/enum.ex:737: Enum."-each/2-lists^foreach/1-0-"/2 (elixir) lib/enum.ex:737: Enum.each/2

14:17:44.572 [error] ** State machine #PID<0.360.0> terminating ** Last message in was {:"$gen_sync_event", {#PID<0.74.0>, #Reference<0.2121126444.1751646212.63875>}, {:send_query, #Reference<0.2121126444.1751646212.63871>, {:cql_query, "DROP KEYSPACE IF EXISTS lukla_dev;", [], :undefined, false, 100, :undefined, :one, :undefined, :undefined}}} ** When State == :live ** Data == {:client_state, :cqerl_auth_plain_handler, :undefined, :undefined, {'cassandra', 9042}, :tcp, #Port<0.8647>, :undefined, :system, :infinity, "", :undefined, [{0, :undefined}, {1, :undefined}, {2, :undefined}, {3, :undefined}, {4, :undefined}, {5, :undefined}, {6, :undefined}, {7, :undefined}, {8, :undefined}, {9, :undefined}, {10, :undefined}, {11, :undefined}, {12, :undefined}, {13, :undefined}, {14, :undefined}, {15, :undefined}, {16, :undefined}, {17, :undefined}, {18, :undefined}, {19, :undefined}, {20, :undefined}, {21, :undefined}, {22, :undefined}, {23, :undefined}, {24, :undefined}, {25, :undefined}, {26, :undefined}, {27, :undefined}, {28, :undefined}, {29, :undefined}, {30, :undefined}, {31, :undefined}, {32, :undefined}, {33, :undefined}, {34, :undefined}, {35, ...}, {...}, ...], {[], []}, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, ...], [], :hash, {{'cassandra', 9042}, [included_applications: [], keyspace: :system, num_clients: 2, query_timeout: 5000]}} ** Reason for termination = ** {:"module could not be loaded", [{:re2, :compile, ['\'(\?|:\w+)\'(?:(?:[^"]"[^"]")[^"]$)'], []}, {:cqerl_cache, :lookup, 2, [file: '/mnt/svcs/lukla/deps/cqerl/src/cqerl_cache.erl', line: 58]}, {:cqerl_client, :live, 3, [file: '/mnt/svcs/lukla/deps/cqerl/src/cqerl_client.erl', line: 244]}, {:gen_fsm, :handle_msg, 8, [file: 'gen_fsm.erl', line: 483]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}]}

我的.dockerignore是:

_build
.git
node_modules
deps
priv/static

我的Dockerfile:

FROM xerpa/ubuntu:v20190114

# Compile in prod mode by default
ARG MIX_ENV=prod

# .mix folder will be inside the project
ARG LUKLA_HOME=/var/www/lukla

ENV MIX_ENV=${MIX_ENV}
ENV LUKLA_HOME=${LUKLA_HOME}
ENV MIX_HOME=${LUKLA_HOME}/.mix

WORKDIR $LUKLA_HOME

RUN wget https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc -O /erlang-solutions.asc \
    && echo deb https://packages.erlang-solutions.com/ubuntu artful contrib | tee /etc/apt/sources.list.d/erlang-solutions.list \
    && apt-key add /erlang-solutions.asc

RUN export DEBIAN_FRONTEND=noninteractive \
    && apt-get update \
    && apt-get install -y \
    esl-erlang=1:20.3 \
    libboost-dev \
    libboost-system-dev \
    libboost-thread-dev \
    libgraphicsmagick-dev \
    libgtest-dev \
    libicu-dev \
    libphonenumber-dev \
    libgeocoding7 \
    libprotobuf-dev \
    libre2-dev \
    libtool-bin \
    libwebp-dev \
    build-essential \
    cmake \
    cmake-curses-gui \
    lsb-release \
    protobuf-compiler \
    openjdk-8-jre \
    locales \
    poppler-utils \
    elixir=1.6.5-1 \
    tzdata \
    && ln -fs /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime \
    && dpkg-reconfigure --frontend noninteractive tzdata \
    && rm -rf /var/lib/apt/lists/*

RUN echo en_US.UTF-8 UTF-8 | tee /etc/locale.gen
RUN echo locales locales/default_environment_locale select en_US.UTF-8 | debconf-set-selections
RUN echo locales locales/locales_to_be_generated multiselect en_US ISO-8859-1, en_US.UTF-8 UTF-8 | debconf-set-selections
RUN locale-gen

# Stuff that should be cached
COPY ./.credo.exs ./.credo.exs
COPY ./.formatter.exs ./.formatter.exs
COPY ./apps/lukla_web/mix.exs ./apps/lukla_web/mix.exs
COPY ./apps/magoo/mix.exs ./apps/magoo/mix.exs
COPY ./apps/yak/mix.exs ./apps/yak/mix.exs
COPY ./mix.exs ./mix.exs
COPY ./mix.lock ./mix.lock
COPY ./config ./config
COPY ./automation ./automation

RUN test -f ${MIX_HOME}/archives/hex*.ez || mix local.hex --force
RUN test -f ${MIX_HOME}/rebar || mix local.rebar --force

RUN mix hex.organization auth xerpa --key xxxxxxxxxxxxxxxxxxxxxxx
RUN mix deps.get
RUN mix deps.compile

COPY ./apps ./apps
COPY ./boot ./boot
COPY ./doc ./doc
COPY ./package ./package

RUN mix compile
RUN mix phoenix.digest apps/lukla_web/web/static/assets -o apps/lukla_web/priv/static

第一条错误消息表明版本已过时,然后我需要解决这个问题:

rm -rf project/_build

再次尝试bootstrap,但是出现第二个错误,关于用不同版本编译的re2库,甚至删除_build和图像也没有解决这个问题,然后我想到了编译项目(和库,然后在bootstrap之后尝试):

mix compile

如@Marcos Tapajós 所述,我相信 mix clean 也可以。

然后我的命令起作用了:

./project bootstrap

我想我的机器上还有其他地方包已经过时了。