【问题标题】:mix deps.get error in elixr guardian after guardian installation安装监护人后在 elixr 监护人中混合 deps.get 错误
【发布时间】:2018-01-11 02:20:40
【问题描述】:

我按照教程安装了 Guardian,使用 {:guardian, "~> 0.14"}。 运行 mix deps.get 时 它给出了这个错误:

** (Mix.Config.LoadError) could not load config config/dev.exs
** (CompileError) config/dev.exs:1: undefined function mix/1
(elixir) lib/code.ex:176: Code.eval_string/3
(mix) lib/mix/config.ex:180: Mix.Config.read!/2
(mix) lib/mix/config.ex:217: anonymous fn/3 in Mix.Config.read_wildcard!/2

这是我的 config/dev.exs 文件。我尝试为监护人生成一个密钥,但它给出了理智的问题

mix phoenix.gen.secretuse Mix.Config

config :sling, Sling.Endpoint,
  http: [port: 4000],
  debug_errors: true,
  code_reloader: true,
  check_origin: false,
  watchers: []

# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"

# Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive.
config :phoenix, :stacktrace_depth, 20

# Configure your database
config :sling, Sling.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: "postgres",
  password: "postgres",
  database: "sling_dev",
  hostname: "localhost",
  pool_size: 10

# Configure Guardian
  config :guardian, Guardian


  import_config "dev.secret.exs"

【问题讨论】:

  • 请发布您的config/dev.exs 文件
  • 我已经做到了

标签: elixir phoenix-framework


【解决方案1】:

从第 1 行删除 mix phoenix.gen.secret 以便成为 use Mix.Config

【讨论】:

  • 从那以后就没有注意到这一点。谢谢
  • 不客气。不要忘记将答案标记为正确。
猜你喜欢
  • 2015-03-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-08
  • 1970-01-01
相关资源
最近更新 更多