Elixir - 从源代码安装Hex包

时间:2016-03-28 17:28:09

标签: elixir

我在代理服务器后面工作,需要为hex项目安装Mix和一些模块。

Eshell V7.2
Interactive Elixir (1.2.2)

我可以使用hex-0.9.0.ez下载Hex来安装mix archive.install F:/hex-0.9.0.ez

$ mix hex
Hex v0.9.0

我正在尝试对https://github.com/kafkaex/kafka_ex/做同样的事情。我下载了.zip并运行了:

$ mix archive.build -i C:/kafka_ex-0.5.0 -o C:/kafka_ex-0.5.0.ez
Generated archive "C:/kafka_ex-0.5.0.ez" with MIX_ENV=dev

然后我跑了:

$ mix archive.install C:/kafka_ex-0.5.0.ez
Are you sure you want to install archive "C:/kafka_ex-0.5.0.ez"? [Yn] Y
* creating .mix/archives/kafka_ex-0.5.0.ez
** (MatchError) no match of right hand side value: {:error, :bad_directory}
    (mix) lib/mix/tasks/archive.install.ex:58:   Mix.Tasks.Archive.Install.install_archive/2
    (mix) lib/mix/tasks/archive.install.ex:40: Mix.Tasks.Archive.Install.run/1
    (mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
    (elixir) lib/code.ex:363: Code.require_file/2

我不确定上述错误是什么,但程序包会显示在存档中:

$ ls c/Users/me/.mix/archives
hex-0.9.0.ez  kafka_ex-0.5.0.ez

我无法弄清楚如何满足我项目中的依赖项。

$ mix deps.get

$ mix deps
* kafka_ex (c:/Users/me/.mix/archives/kafka_ex-0.5.0.ez)
  the dependency is not available

$ iex -S mix
Eshell V7.2  (abort with ^G)
Unchecked dependencies for environment dev:
* kafka_ex (c:/Users/me/.mix/archives/kafka_ex-0.5.0.ez)
  the dependency is not available
** (Mix) Can't continue due to errors on dependencies

有什么建议吗?当我从源代码构建/安装或者我的mix.exs文件错误时,我可能做错了。

mix.exs

defmodule Voting.Mixfile do
  use Mix.Project

  def project do
    [app: :voting,
     version: "0.0.1",
     elixir: "~> 1.2",
     build_embedded: Mix.env == :dev,
     start_permanent: Mix.env == :dev,
     deps: deps]
  end

  def application do
    [applications: [:logger, :kafka_ex],
    mod: {Voting, []}]
  end

  defp deps do
    [{:kafka_ex, path: "c:/Users/me/.mix/archives/kafka_ex-0.5.0.ez"}]
  end
end

1 个答案:

答案 0 :(得分:1)

如果我不得不猜测我说这是错误信息你应该注意:

** (MatchError) no match of right hand side value: {:error, :bad_directory}

我说它似乎表明它无法在c / Users / me / .mix / archives下创建该kafka目录。尝试手动创建目录,当您创建目录时,请重试mix archive.install C:/kafka_ex-0.5.0.ez