运行mix deps.get引发:erlang.binary_to_atom参数错误

时间:2018-11-14 05:35:58

标签: elixir nerves-project

我正在构建一个Nerves项目,并试图验证我的自定义固件是否将按照here的说明由主Nerves应用程序构建。我已经用Phoenix设置了一个UI项目,并将自定义图像放在项目目录下它自己的目录中。 Nerves的主要项目是here,自定义固件是here,我将MIX_TARGET设置为与自定义映像名称(rpi0_wiringPi)相同,并且在运行时:

mix deps.get

我得到了错误

* (ArgumentError) argument error
:erlang.binary_to_atom(nil, :utf8)
(stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
(stdlib) erl_eval.erl:888: :erl_eval.expr_list/6
(stdlib) erl_eval.erl:240: :erl_eval.expr/5
(stdlib) erl_eval.erl:232: :erl_eval.expr/5
(stdlib) erl_eval.erl:233: :erl_eval.expr/5
(stdlib) erl_eval.erl:888: :erl_eval.expr_list/6
(stdlib) erl_eval.erl:240: :erl_eval.expr/5

现在,我对该目录中的混合所做的任何操作都会引发相同的错误,包括混合帮助。那会告诉我该项目的mix.exs文件中有什么不对劲,但它在下面,对我来说很好

defmodule Fw.MixProject do
  use Mix.Project

  @target System.get_env("MIX_TARGET") || "host"

  def project do
    [
      app: :fw,
      version: "0.1.0",
      elixir: "~> 1.4",
      target: @target,
      archives: [nerves_bootstrap: "~> 1.0"],
      deps_path: "deps/#{@target}",
      build_path: "_build/#{@target}",
      lockfile: "mix.lock.#{@target}",
      start_permanent: Mix.env() == :prod,
      aliases: [loadconfig: [&bootstrap/1]],
      deps: deps()
    ]
  end

  # Starting nerves_bootstrap adds the required aliases to Mix.Project.config()
  # Aliases are only added if MIX_TARGET is set.
  def bootstrap(args) do
    Application.start(:nerves_bootstrap)
    Mix.Task.run("loadconfig", args)
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
    mod: {Fw.Application, []},
    extra_applications: [:logger, :runtime_tools]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:nerves, "~> 1.3", runtime: false},
      {:nerves_network, "~> 0.3"},
      {:ui, path: "../ui"},
      {:shoehorn, "~> 0.2"}
    ] ++ deps(@target)
  end

  # Specify target specific dependencies
  defp deps("host"), do: []

  defp deps(target) do
    [
      {:nerves_runtime, "~> 0.8"}
    ] ++ system(target)
  end

  defp system("rpi"), do: [{:nerves_system_rpi, "~> 1.0", runtime: false}]
  defp system("rpi0"), do: [{:nerves_system_rpi0, "~> 1.0", runtime: false}]
  defp system("rpi0_wiringPi"), do: [{:nerves_system_rpi0_wiringPi, path: "../nerves_system_rpi0_wiringPi", runtime: false}]
  defp system("rpi2"), do: [{:nerves_system_rpi2, "~> 1.0", runtime: false}]
  defp system("rpi3"), do: [{:nerves_system_rpi3, "~> 1.0", runtime: false}]
  defp system("bbb"), do: [{:nerves_system_bbb, "~> 1.0", runtime: false}]
  defp system("ev3"), do: [{:nerves_system_ev3, "~> 1.0", runtime: false}]
  defp system("qemu_arm"), do: [{:nerves_system_qemu_arm, "~> 1.0", runtime: false}]
  defp system("x86_64"), do: [{:nerves_system_x86_64, "~> 1.0", runtime: false}]
  defp system(target), do: Mix.raise("Unknown MIX_TARGET: #{target}")
end

这是目录结构:

clicky
  fw
  ui
  nerves_system_rpi0_wiringPi

由于无论我做什么,mix都会引发错误,因此我无法从中获得任何帮助。有没有办法让混合方式写日志来说明正在做什么或其他可以帮助我解决问题的方法?

1 个答案:

答案 0 :(得分:0)

我也遇到了这个错误。原来不是mix.exs的问题。我忽略了在config.exs中设置Nerves网络环境变量(NERVES_NETWORK_SSID,NERVES_NETWORK_PSK和NERVES_NETWORK_MGMT)。一旦我修复了“ mix deps.get”,就可以使用。