elixir - mix deps.get: Hex 安装到错误的 elixir 版本中
问题描述
这是我第一次使用命令:
$ mix deps.get
这是输出:
Could not find Hex, which is needed to build dependency :ecto
Shall I install Hex? (if running non-interactively, use "mix local.hex --force") [Yn] Y
* creating /Users/7stud/.kiex/mix/archives/elixir-1.4.1/hex-0.18.1
Resolving Hex dependencies...
Dependency resolution completed:
New:
connection 1.0.4
db_connection 1.1.3
decimal 1.5.0
ecto 2.2.10
poolboy 1.5.1
postgrex 0.13.5
* Getting ecto (Hex package)
* Getting postgrex (Hex package)
* Getting connection (Hex package)
* Getting db_connection (Hex package)
* Getting decimal (Hex package)
* Getting poolboy (Hex package)
~/elixir_programs/friends$ iex
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.6.6) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
^C$ which iex
/Users/7stud/.asdf/shims/iex
$ which elixir
/Users/7stud/.asdf/shims/elixir
$ asdf current
elixir 1.6.6 (set by /Users/7stud/.tool-versions)
erlang 20.3 (set by /Users/7stud/.tool-versions)
$ asdf list elixir
1.6.6
$ asdf list erlang
20.3
我安装otp 20.3
并elixir 1.6.6
使用asdf
包管理器:
^C$ which iex
/Users/7stud/.asdf/shims/iex
$ which elixir
/Users/7stud/.asdf/shims/elixir
$ asdf current
elixir 1.6.6 (set by /Users/7stud/.tool-versions)
erlang 20.3 (set by /Users/7stud/.tool-versions)
$ asdf list elixir
1.6.6
$ asdf list erlang
20.3
我不在乎我使用什么包管理器。如何确保在 elixir 1.6.6 中安装了 Hex 之类的东西?我什至在我的系统上找不到 elixir 1.4.1:
$ elixir -v
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Elixir 1.6.6 (compiled with OTP 19)
那么 Hex 安装程序是如何找到 elixir 1.4.1 的呢?
如果我删除我.bash_profile
安装的行asdf shims
,然后我打开一个新的终端窗口,这就是我得到的:
~$ which elixir
/Users/7stud/.kiex/elixirs/elixir-1.4.1/bin/elixir
~$ which mix
/Users/7stud/.kiex/elixirs/elixir-1.4.1/bin/mix
~$
我在 google 上搜索.kiex
,看起来我一定是kiex
在某个时候安装了 elixir 的版本管理器。
我的一些线路.bash_profile
也安装了kiex
垫片。我注释掉了 shims 的行kiex
并取消了注释asdf
,我打开了一个新的终端窗口,我再次尝试了 mix 命令:
$mix deps.get
Could not find Hex, which is needed to build dependency :ecto
Shall I install Hex? (if running non-interactively, use "mix local.hex --force") [Yn] Y
* creating /Users/7stud/.asdf/installs/elixir/1.6.6/.mix/archives/hex-0.18.1
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
connection 1.0.4
db_connection 1.1.3
decimal 1.5.0
ecto 2.2.10
poolboy 1.5.1
postgrex 0.13.5
All dependencies up to date
成功。
下一个问题:
~/elixir_programs/friends$ mix exto.gen.repo -r Friends.Repo
==> connection
Compiling 1 file (.ex)
Generated connection app
==> friends
Could not find "rebar", which is needed to build dependency :poolboy
I can install a local copy which is just used by Mix
Shall I install rebar? (if running non-interactively, use "mix local.rebar --force") [Yn]
但是,在另一个终端窗口中:
$ which rebar
/usr/local/bin/rebar
~$ rebar --version
rebar 2.6.4 19 20170625_072305 git 2.6.4-6-g2a52f60
~$ which rebar3
/usr/local/bin/rebar3
~$ rebar3 --version
rebar 3.0.0-beta.4+build.3189.ref21ae314 on Erlang/OTP 20 Erts 9.3
那么,为什么混合找不到我的钢筋?
解决方案
从您的评论来看,它似乎kiex
与asdf
.
kiex
从您的 中删除对的引用.bash_profile
,asdf
垫片应该可以正常工作。
推荐阅读
- iphone - 魔码 | iOS 构建失败
- java - getAWTGraphicsConfiguration 返回空错误
- amazon-web-services - Amplify 构建失败并显示“请求失败 401 未授权”
- python - Jupyter Notebook 中的乘法
- docker - "##[error]来自守护进程的错误响应:未能达到构建目标
在 Dockerfile 中”仅在 CI 管道期间 - javascript - javascript 中的动画,其中 DOM 插入了 Jquery
- r - 找出一个数字在给定范围内排名的百分位数?
- android - Android Java) 自定义 ArrayAdapter 中的 TextView 为空,而 Button 不为空
- python - 删除列表中变成字符串的空间
- node.js - 如何从 mac 中完全删除 NPM 包?