[英]Elixir - Installing Hex packages from source
I am working behind a proxy and need to install hex
and some modules for a Mix
project.我在代理后面工作,需要为
Mix
项目安装hex
和一些模块。
Eshell V7.2
Interactive Elixir (1.2.2)
I was able to download hex-0.9.0.ez
to install Hex
using mix archive.install F:/hex-0.9.0.ez
.我能够使用
mix archive.install F:/hex-0.9.0.ez
下载hex-0.9.0.ez
来安装Hex
。
$ mix hex
Hex v0.9.0
I am trying to do the same with https://github.com/kafkaex/kafka_ex/ .我正在尝试对https://github.com/kafkaex/kafka_ex/做同样的事情。 I downloaded the
.zip
and ran:我下载了
.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
Then I ran:然后我跑了:
$ 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
I'm not sure what the above error is, but the package appears in the archive:我不确定上述错误是什么,但该包出现在存档中:
$ ls c/Users/me/.mix/archives
hex-0.9.0.ez kafka_ex-0.5.0.ez
I can't figure out how to satisfy the dependencies in my project though.我不知道如何满足我的项目中的依赖项。
$ 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
Any suggestions?有什么建议? Maybe I'm doing something incorrect when I build/install from source or maybe my
mix.exs
file is wrong.也许我在从源代码构建/安装时做错了什么,或者我的
mix.exs
文件是错误的。
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
If I had to guess I'd say this is the error message you should be paying attention to:如果我不得不猜测,我会说这是您应该注意的错误消息:
** (MatchError) no match of right hand side value: {:error, :bad_directory}
I'd say it seems to indicate that it can't create that kafka directory under c/Users/me/.mix/archives.我会说它似乎表明它无法在 c/Users/me/.mix/archives 下创建那个 kafka 目录。 Try manually creating the directory and when you've created it then retry
mix archive.install C:/kafka_ex-0.5.0.ez
尝试手动创建目录,创建后重试
mix archive.install C:/kafka_ex-0.5.0.ez
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.