5

I use asdf to install Erlang and then Elixir.

asdf install elixir 1.14.0-rc.1-otp-25

This results in:

asdf install elixir 1.14.0-rc.1-otp-25

And then ...

$ elixir
No version is set for command elixir
Consider adding one of the following versions in your config file at 
elixir 1.14.0-rc.1-otp-25
$ |

Which config file is this referring to?

Adam Millerchip
  • 20,844
  • 5
  • 51
  • 74
Liberty Lover
  • 844
  • 10
  • 12
  • 2
    Maybe you should make it your global default using `asdf global elixir 1.14.0-rc.1-otp-25`, or locally using `asdf local elixir 1.14.0-rc.1-otp-25` (which will create a `.tool-versions` config file in your current directory). Does it fix it? – sabiwara Sep 02 '22 at 23:18

2 Answers2

10

TLDR:

  1. asdf install elixir latest
  2. asdf global elixir latest

Or in your specific case: asdf global elixir 1.14.0-rc.1-otp-25

See the Set a Version section of the asdf docs:

6. Set a Version

asdf performs a version lookup of a tool in all .tool-versions files from the current working directory up to the $HOME directory. The lookup occurs just-in-time when you execute a tool that asdf manages.

::: warning Without a version listed for a tool execution of the tool will error. asdf current will show you the tool & version resolution, or absence of, from your current directory so you can observe which tools will fail to execute. :::

Global

Global defaults are managed in $HOME/.tool-versions. Set a global version with:

asdf global nodejs latest

$HOME/.tool-versions will then look like:

nodejs 16.5.0

Some OSs already have tools installed that are managed by the system and not asdf, python is a common example. You need to tell asdf to pass the management back to the system. The Versions reference section will guide you.

Local

Local versions are defined in the $PWD/.tool-versions file (your current working directory). Usually, this will be the Git repository for a project. When in your desired directory execute:

asdf local nodejs latest

$PWD/.tool-versions will then look like:

nodejs 16.5.0

Using Existing Tool Version Files

asdf supports the migration from existing version files from other version managers. Eg: .ruby-version for the case of rbenv. This is supported on a per-plugin basis.

asdf-nodejs supports this via both .nvmrc and .node-version files. To enable this, add the following to your asdf configuration file $HOME/.asdfrc:

legacy_version_file = yes

See the configuration reference page for more config options.

Adam Millerchip
  • 20,844
  • 5
  • 51
  • 74
  • I opted for Kiex in the meantime and will have to circle back to this in the future if need be. However, I will mark this as answered because it might just do it. Looks like it makes sense. Thank you, @Adam Millerchip – Liberty Lover Sep 04 '22 at 14:37
-1

It is referring to the .tool-versions file. See similar post below:

https://elixirforum.com/t/error-when-checking-elixir-version/37965/5

  • Links are not welcome as answers on this site. Please consider either post this as a comment, or elaborating so that it would be a ready-to-go answer. See https://stackoverflow.com/help/how-to-answer for reference. – Aleksei Matiushkin Sep 03 '22 at 04:07