gpt4 book ai didi

elixir - 删除`:gettext` in mix. exs文件后,面临 `__hash__`未定义问题

转载 作者:行者123 更新时间:2023-12-02 01:30:20 25 4
gpt4 key购买 nike

我想删除下面的错误信息,删除:gettext后又报错

warning: the :gettext compiler is no longer required in your mix.exs.

Please find the following line in your mix.exs and remove the :gettext entry:

compilers: [..., :gettext, ...] ++ Mix.compilers(),

(gettext 0.20.0) lib/mix/tasks/compile.gettext.ex:5: Mix.Tasks.Compile.Gettext.run/1
(mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
(mix 1.13.4) lib/mix/tasks/compile.all.ex:92: Mix.Tasks.Compile.All.run_compiler/2
(mix 1.13.4) lib/mix/tasks/compile.all.ex:72: Mix.Tasks.Compile.All.compile/4
(mix 1.13.4) lib/mix/tasks/compile.all.ex:59: Mix.Tasks.Compile.All.with_logger_app/2
(mix 1.13.4) lib/mix/tasks/compile.all.ex:36: Mix.Tasks.Compile.All.run/1

更新 mix.exs 如下:

  def project do
[
app: :hello,
version: "0.1.0",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
# compilers: [:gettext] ++ Mix.compilers(),
compilers: Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
end

defp deps do
[
{:phoenix, "~> 1.6.10"},
{:phoenix_html, "~> 3.0"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.17.5"},
{:floki, ">= 0.30.0", only: :test},
{:phoenix_live_dashboard, "~> 0.6"},
{:esbuild, "~> 0.4", runtime: Mix.env() == :dev},
{:swoosh, "~> 1.3"},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_poller, "~> 1.0"},
# {:gettext, "~> 0.18"},
{:jason, "~> 1.2"},
{:plug_cowboy, "~> 2.5"}
]
end

出现以下错误消息。如何解决?

(Debugger) Initialization failed because an exception was raised:
** (UndefinedFunctionError) function Gettext.Compiler.__hash__/1 is undefined (module Gettext.Compiler is not available)
Gettext.Compiler.__hash__("priv/gettext")
lib/hello_web/gettext.ex:1: HelloWeb.Gettext.__mix_recompile__?/0
(mix 1.13.4) lib/mix/compilers/elixir.ex:294: anonymous fn/2 in Mix.Compilers.Elixir.compiler_info_from_updated/9
(elixir 1.13.4) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(mix 1.13.4) lib/mix/compilers/elixir.ex:293: Mix.Compilers.Elixir.compiler_info_from_updated/9
(mix 1.13.4) lib/mix/compilers/elixir.ex:117: Mix.Compilers.Elixir.compile/7
(mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
(mix 1.13.4) lib/mix/tasks/compile.all.ex:92: Mix.Tasks.Compile.All.run_compiler/2

最佳答案

不应该删除 gettext 依赖项,只能删除编译器。也就是说,以下行保留:

{:gettext, "~> 0.18"},

compiler提供了额外的编译步骤,不再需要了,但是仍然需要在那里定义的所有模块和函数。

关于elixir - 删除`:gettext` in mix. exs文件后,面临 `__hash__`未定义问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73453449/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com