みずりゅの自由帳

主に参加したイベントやソフトウェア技術/開発について記録しています

nerves_bootstrap1.6.0ではElixir1.9を要求される

※本記事は、2019.07.15時点の情報で記述しています。

備忘。

mix local.nerves」コマンドを実行してnerves_bootstrap のバージョンを上げてしまい、「mix nerves.new」コマンドが実施できなくなった。

バージョンアップしたnerves_bootstrapが利用できるElixirのバージョンにするか、現在のElixirで利用できるバージョンのnerves_bootstrapに戻す必要があります。今回は前者で対応しました。



2019/07/12に、Nervesのバージョン1.5がリリースされました。

elixirforum.com

Nerves 1.5.0 になったことにより、Elixirのバージョン1.9がサポートされるようになりました。なお、Nerves 1.4系でサポートされていたElixirのバージョンは1.8系でした。

Nerves の利用には「nerves_bootstrap」のインストールが必要になります。そして、Nerves 1.5のインストール手順に従った場合、バージョン指定がないのでインストールされるnerves_bootstrapのバージョンは1.6.0 (2019.07.15時点)となります。

hexdocs.pm

nerves_bootstrap 1.6.0は、「mix nerves.new」コマンドを実行する際にElixir 1.9以上を要求します。そのため、Elixir 1.9より前のバージョン(Elixir 1.8.1等)の環境でnerves_bootstrap 1.6.0 以上のバージョンをインストールしてしまうと、「mix nerves.new」コマン実行時に以下のようなエラーメッセージが表示されます。

$mix nerves.new hello_nerves
** (Mix) Nerves Bootstrap v1.6.0 creates projects that require Elixir ~> 1.9.

You have Elixir 1.8.1. Please update your Elixir version or downgrade
the version of Nerves Bootstrap that you're using.

See https://hexdocs.pm/nerves/installation.html for more information on
setting up your environment.

$

asdfでElixir 1.9をインストール後、インストール手順に従い「mix local.hex」「mix local.rebar」「mix archive.install hex nerves_bootstrap」を実施すれば、「mix nerves.new」が動くようになりました。

$mix nerves.new hello_nerves
* creating hello_nerves/config/config.exs
* creating hello_nerves/config/target.exs
* creating hello_nerves/lib/hello_nerves.ex

〜(中略)〜

Now download the dependencies and build a firmware archive:
  $ cd hello_nerves
  $ mix deps.get
  $ mix deps.get
  $ mix firmware

If your target boots up using an SDCard (like the Raspberry Pi 3),
then insert an SDCard into a reader on your computer and run:
  $ mix firmware.burn

Plug the SDCard into the target and power it up. See target documentation
above for more information and other targets.
$