mix が動かない原因が分かった。
「elixir iex INFO REPORT」
でググるといくつか情報が出ていて、日本語の情報だとQiitaのこちらの記事が参考になりそうです。
qiita.com
※参考にさせて頂き、ありがとうございます (m_m)
手元で確認したバージョンと結果
ということで、原因は要するに、 Erlang/OTPとElixirのバージョンの相性ということで間違いなさそう。
Linux環境では基本的にapt-getでインストールしていたけど、インストールされるOTPのバージョンが違うために偶然にもうまく動くパターンもあった。
多分apt使うときにupdateとか叩き忘れているという・・・
手元で確認したバージョンとかの組み合わせを一応あげておきます。
| OS | Elixir | Erlang/OTP | 動作 | インストール方法 |
|---|---|---|---|---|
| Linux Mint | Elixir 1.1 | 18 | OK | apt |
| Linux Mint | Elixir 1.1 | 20 | NG | apt |
| Windows10 | Elixir 1.1 | 20 | OK | インストーラ |
試したかったこと
さて、とりあえず手元にうごく環境もあるということでmixの勉強をしてみる。
Mixの使い方を知るには、
がよさそう。
早速 mix new で新しいプロジェクトを作る。
やりたいのはHTTP通信(クライアント側)HTTPクライアントの機能を使ってみたいのでプロジェクト名はhttpとした。
HTTPPoisonというモジュールがあるらしい。
$ mix new http
* creating README.md
* creating .gitignore
* creating mix.exs
* creating config
* creating config/config.exs
* creating lib
* creating lib/http.ex
* creating test
* creating test/test_helper.exs
* creating test/http_test.exs
Your mix project was created successfully.
You can use mix to compile it, test it, and more:
cd http
mix test
Run `mix help` for more commands.
mix deps.get が失敗した
$ mix deps.get
が bundle install 相当のコマンドになるようだ。
最初にmix deps.getを実行したときにモジュールの取得に失敗していた。
20:10:50.392 [error] SSL: :certify: ssl_handshake.erl:1474:Fatal error: certificate expired Failed to check for new Hex version Failed to fetch record for 'hexpm/httpoison' from registry (using cache) 20:10:50.393 [error] SSL: :certify: ssl_handshake.erl:1474:Fatal error: certificate expired 20:10:50.394 [error] SSL: :certify: ssl_handshake.erl:1474:Fatal error: certificate expired
ログをみてみるとSSL認証で失敗しているらしい。Elixirを試しているのはVM Ware Player上のLinux Mintだが案の定時間が大幅にずれていた。
時刻を合わせて再度試したらうまくいったようだ。いろいろとトラブルが発生するものだ・・・
続きは明日にしよう。