Error creating new project

Okay, so I’m a newbie, and there’s probably something very simple I’m missing. But this is pretty obviously wrong:

  $ mix phoenix.new recommenjion

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

I am not sure how to check which version of Phoenix I have, but I think it’s at least 1.2. And I was able to create a project without difficulty last month when I started the Programming Phoenix book. Something has broken in the last few weeks.

1 Like

mix phoenix.new means You are using phoenix version 1.2

The new version uses mix phx.new.

I tried your command in my console and it worked fine.

Maybe You can try with the new generator, if You have it.

$ mix phx.new recommenjion

Or maybe try a simple name and see how it goes. (Because it seems the app name is causing trouble)

$ mix phoenix.new yo
1 Like

Thanks for the quick response!

Okay, I guess I don’t have the new version.

$ mix phx.new recommenjion
** (Mix) The task "phx.new" could not be found

I don’t have any reason not to upgrade to a newer version, but I can’t find a newer version, or any instructions on how to upgrade to it. I just checked the Upgrading guide at phoenixframework.org, and it points to the News page. But 1.2 is the newest version shown on the News page - and I upgraded to that just in case - but nothing has changed.

Nope, same error. I also tried ‘mix phoenix.new hello_phoenix’, which I have done before, and that didn’t work either.

To get phoenix 1.3, follow the link

It might be that you’re using outdated Phoenix archive. You can find out which version you have by running

$ mix --help | grep phoenix.new
mix phoenix.new       # Creates a new Phoenix vX.X.X application

where X.X.X is your current version. I also tried just now and encountered the same issue with Phoenix v1.2.1. To update, run

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

It will ask to replace your current version. I’ve updated to v1.2.4 and the issue is no longer there. Can you try that?

As for what breaks: I’m guessing it’s because updated Elixir version introduces bug somewhere for v1.2. I think I’ve read an issue or thread about it but I can’t seem to find it now.

Also, @kokolegorille I’m not sure telling beginners to use 1.3 rc is a good idea… at least not until the official guides are updated. Most books and guides still use 1.2, no?

1 Like

Yes, but I was just answering about where to find the new generator :slight_smile:

1 Like

Okay, I do have v1.2.4, and … the problem is gone! Thank you.

The weird thing is, though, I didn’t just upgrade; I upgraded earlier today, and the phoenix.new command failed several times after that … now it works, in the same bash shell, without my having changed anything in between. I would be interested to know the cause of that.

That’s weird. For me it just worked right after upgrading… Probably there was some state inconsistencies at one point in time on your machine triggering some heisenbug :smile: glad to hear that it works now.