Getting name error when attempting to create a new Mix project

Noob here with a likely stupid problem:

I’m currently working through Dave Thomas’s Programming Elixir 1.3, and am trying to code along with Ch. 18 - OTP: Supervisors. I created the chapter’s Mix project using $ mix new --sup sequence (as on p230 of the book). The standard directory was created. Then, as I looked through the source files, I realized that I had accidentally initialized the project using Elixir 1.4 (installed using the asdf version manager), and that – as discussed elsewhere in the forum – there had been some changes between 1.3 and 1.4 in the generated source code pertaining to supervisors. So, I moved up a directory, created a parallel one with a different name , entered it, used asdf to switch to Elixir 1.3.4 locally, and ran $ mix new --sup sequence in the new folder using 1.3. But, I got this error:

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

I did some looking around, and tried something different, in yet another newly created directory; I got the same issue back:

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

I tried setting the Mix app name explicitly, but still no luck:

$ mix new seq13 --sup --app seq13
** (Mix) Application name must start with a letter and have only lowercase letters, numbers and underscore, got: "seq13"

What am I doing wrong? Did I need to do something else differently after my initial Mix project creation? Or am I making some other stupid beginner’s mistake?

$ mix new --sup sequence

This is the wrong order. It’s better to put the new with the name of the project, then the options.

You have another problem, because it’s working on mine.

$ mix --version
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

Mix 1.5.0
$ mix new seq13 --sup
* creating README.md
* creating .gitignore
* creating mix.exs
* creating config
* creating config/config.exs
* creating lib
* creating lib/seq13.ex
* creating lib/seq13/application.ex
* creating test
* creating test/test_helper.exs
* creating test/seq13_test.exs

Your Mix project was created successfully.
You can use "mix" to compile it, test it, and more:

    cd seq13
    mix test

Run "mix help" for more commands.

BTW with the new version of Elixir, main supervisor is defined in

lib/project_name/application.ex

but before, it was in

lib/project_name.ex

1 Like

Thanks!

I wonder if there’s something going wrong “under the hood” in my case – if there isn’t some Beam cache that isn’t getting properly cleared, or some Mix-specific lock that I didn’t properly release…

Maybe You can output the version of your mix, elixir and erlang. And maybe tell us about your OS.

But You do not seem to have a mistake in your command syntax.

1 Like

kokolegorille, thanks so much for your patience and help – you asked me the questions I should have asked myself in the first place: I now have it figured out, and it was indeed a stupid mistake on my part. Basically, via asdf, I was trying to use Elixir 1.3.4 with Erlang 20.0. Once I installed Erlang 19.3 and set it as the locally-preferred Erlang version, $ mix new sequence --sup worked precisely as it should.

Thanks again, and apologies for taking up your time…

Glad You made it work.