不知什么时候把erlang OTP 和elixir的版本升上去了,和服务器环境不一样了,然后苦逼的事情就开始了,重新安装erlang 和elixir,让其版本和服务器一样。
In this episode we’ll look at one way to install Elixir.
I’ve been using the version manager asdf to handle different versions of Elixir. What’s nice about asdf is that it easily lets you manage different versions of multiple programming languages, like Node and Ruby.
Here are the more comprehensive install instructions, but let’s take a look at how we can install and use it. I’ll copy the URL to download it. And since I’m on a Mac, I’ll be following the instructions for MacOS in the Readme. We’ll clone asdf and add it to the .bash_profile.
1.安装asdf
mac: 直接用brew,会自动下载依赖
brew install asdf
2.
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.5.1
3.配置环境变量(很重要,很重要,很重要,重要的事情说3遍)
mac系统:
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
$ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile
4、安装elixir
//安装插件
asdf plugin-add elixir
//安装具体版本的elixi
asdf install elixir 1.6.5
//设置包的局部版本
asdf local elixir 1.6.5
//查看
asdf list elixir
//执行elixir -v, 通常会说 erl: not found, 正常情况,需要安装erlang了
elixir -v
5、安装erlang
asdf plugin-add erlang
asdf install erlang 20.3
asdf global erlang 20.3
//测试安装结果
erl
7:参考:
https://elixircasts.io/installing-elixir-with-asdf
https://github.com/asdf-vm/asdf