Problems with mix new project

Hi,

I am a new in elixir/erlang environment. After installing erlang and elixir, I’ trying to create new phoenix project but mix returns me an error. This are commands I used and theirs returns:

 sudo apt install erlang

 sudo apt install elixir 

 mix local.hex 

it’s to install hex to use phoenix

The returns of this command: 

** (Mix) The task "local.hex" could not be found

And when I tried

mix new kemm

I got

** (Mix) Application name must start with a letter and have only lowercase letters, numbers and underscore, got: "kemm". The application name is inferred from the path, if you'd like to explicitly name the application then use the "--app APP" option.

The latter is a known bug with certain combinations of elixir and Erlang, could you please check your versions of both and try to update them?

Perhaps you want to use the Erlang solution repositories anyway, the give you more recent versions that the regular Debian or Ubuntu repositories usually do.

Or you could even use asdf with asdf-erlang and asdf-elixir plugins, to manage multiple versions of Erlang and elixir.

2 Likes

Thanks ! :slight_smile:

For others who will have installation problems:

After removed elixir/erlang with apt, I followed this tuto then this to install erlang/elixir ( don’t forget to exit and open a new terminal to load modifications in bashrc ).

After that, I installed hex and phoenix with these command:

asdf global erlang <your version>   

mix local.hex

mix archive.install https://github.com/phoenixframework/archives/raw/master/<last_version>/phx_new.ez
1 Like

As it does not seem to be mentionned in the links but in asdf-elixir plugin documentation, I would mention that I usually install asdf-erlang first, then I can specify the OTP version with -otp-${OTP_MAJOR_VERSION} when installing Elixir…

In your case. it would be

asdf install elixir {VERSION}-otp-21
2 Likes