Running mix deps.get throws :erlang.binary_to_atom argument error

狂风中的少年 提交于 2021-01-29 09:31:58

问题


I'm building a Nerves project and am attempting to verify my custom firmware will be built with the main Nerves application following the instructions here. I've set up a UI project with Phoenix and have the custom image in its own directory under a project directory. The main Nerves project is here and the custom firmware is here I've set my MIX_TARGET equal to the custom image name (rpi0_wiringPi) and when running:

mix deps.get

I get the error

* (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

And now anything I do regarding mix in that directory throws the same error including mix help. That would tell me something is amiss in the mix.exs file for that project but it's below and appears fine to me

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

This is the directory structure:

clicky
  fw
  ui
  nerves_system_rpi0_wiringPi

Since mix is throws the error no matter what I do, I cannot get any assistance from it. Is there a way to have mix write a log of what it's doing or something else that would help me troubleshoot the issue?


回答1:


I also ran into this error. Turns out not to have been a problem with mix.exs. I had neglected to set the Nerves networking environment variables(NERVES_NETWORK_SSID, NERVES_NETWORK_PSK and NERVES_NETWORK_MGMT) in config.exs. Once I fixed that 'mix deps.get' worked.



来源:https://stackoverflow.com/questions/53293785/running-mix-deps-get-throws-erlang-binary-to-atom-argument-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!