I reinstall everything and start from zero for this.
Erlang/OTP 21 [erts-10.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.7.1 (compiled with Erlang/OTP 21)
When I run mix help phx.new it should show the documentation of the task
mix phx.new
There is no documentation for this task
Location: /Users/ubi/.mix/archives/phx_new/phx_new/ebin
what's your Elixir version?
@wojtekmach sorry I copy everything except the elixir version, my bad. I updated the ticket.
I can confirm lack of help on Elixir 1.7.1, however 1.6.5 looks good.
asdf global elixir 1.6.5-otp-21 && \
mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez --force && \
mix help phx.new
asdf global elixir 1.7.1-otp-21 && \
mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez --force && \
mix help phx.new
Thanks for the report. I can also confirm this is an issue with elixir 1.7, where <= 1.6 is good. Paging @josevalim
For Phoenix v1.4 we should migrate the installation to mix archive.install hex phx_new, this way it will always be compiled on the user's machine and we won't have to worry about things such as missing documentation.
Building the archive against elixir 1.7 fixes the issue, but I'm not sure if we can rely on this if we intend to support >= 1.6 on the archive?
The solution is not very clear, it leads to a new situation, when I run mix archive.install hex phx_new, an error shows:
Failed to fetch record for 'hexpm/phx_new' from registry (using cache)
This could be because the package does not exist, it was spelled incorrectly or you don't have permissions to it
** (Mix) No package with name phx_new (from: mix.exs) in registry
so how to solve this issue exactly?
We haven't yet published the archive as a hex release, which is why hex is failing to fetch it. It will be published as part of our 1.4 release.
For those coming to this thread looking for workaround instructions, the following fixed it for me:
git clone [email protected]:phoenixframework/phoenix.git
git checkout v1.3.4
cd installer
mix archive.uninstall phx_new
MIX_ENV=prod mix do archive.build, archive.install
Then it works just as expected:
mix help phx.new
Creates a new Phoenix project.
It expects the path of the project as an argument.
mix phx.new PATH [--module MODULE] [--app APP]
A project at the given PATH will be created. The application name and module
name will be retrieved from the path, unless --module or --app is given.
## Options
• --umbrella - generate an umbrella application, with one application for
your domain, and a second application for the web interface.
• --app - the name of the OTP application
• --module - the name of the base module in the generated skeleton
• --database - specify the database adapter for Ecto. One of:
• postgres (https://github.com/elixir-ecto/postgrex)
• mysql (https://github.com/xerions/mariaex)
• mssql (https://github.com/findmypast-oss/mssqlex)
Please check the driver docs, between parentheses, for more information and
requirements. Defaults to "postgres".
• --no-brunch - do not generate brunch files for static asset building.
When choosing this option, you will need to manually handle JavaScript
dependencies if building HTML apps
• --no-ecto - do not generate Ecto files.
• --no-html - do not generate HTML views.
• --binary-id - use binary_id as primary key type in Ecto schemas
When passing the --no-ecto flag, Phoenix generators such as phx.gen.html,
phx.gen.json and phx.gen.context may no longer work as expected as they
generate context files that rely on Ecto for the database access. In those
cases, you can pass the --no-context flag to generate most of the HTML and JSON
files but skip the context, allowing you to fill in the blanks as desired.
Similarly, if --no-html is given, the files generated by phx.gen.html will no
longer work, as important HTML components will be missing.
## Examples
mix phx.new hello_world
Is equivalent to:
mix phx.new hello_world --module HelloWorld
Or without the html bits (useful for APIs):
mix phx.new ~/Workspace/hello_world --no-html
As an umbrella:
mix phx.new hello --umbrella
Would generate the following directory structure and modules:
hello_umbrella/ Hello.Umbrella
apps/
hello/ Hello
hello_web/ HelloWeb
You can read more about umbrella projects using the official Elixir guide
(http://elixir-lang.org/getting-started/mix-otp/dependencies-and-umbrella-apps.html#umbrella-projects)
The phx_new archive can now be installed via hex, which will prevent this issue. For example:
$ mix archive.install hex phx_new 1.4.0-dev.0
Chris, I just tried that, and I got:
Resolving Hex dependencies...
Dependency resolution completed:
New:
phx_new 1.4.0-dev.0
* Getting phx_new (Hex package)
All dependencies up to date
Compiling 10 files (.ex)
warning: redefining module Mix.Tasks.Local.Phx (current version loaded from /Users/raarts/.mix/archives/phx_new/phx_new/ebin/Elixir.Mix.Tasks.Local.Phx.beam)
lib/mix/tasks/local.phx.ex:1
warning: redefining module Mix.Tasks.Phx.New.Web (current version loaded from /Users/raarts/.mix/archives/phx_new/phx_new/ebin/Elixir.Mix.Tasks.Phx.New.Web.beam)
lib/mix/tasks/phx.new.web.ex:1
warning: redefining module Phx.New.Project (current version loaded from /Users/raarts/.mix/archives/phx_new/phx_new/ebin/Elixir.Phx.New.Project.beam)
lib/phx_new/project.ex:1
warning: redefining module Phx.New.Ecto (current version loaded from /Users/raarts/.mix/archives/phx_new/phx_new/ebin/Elixir.Phx.New.Ecto.beam)
lib/phx_new/ecto.ex:1
warning: redefining module Mix.Tasks.Phx.New.Ecto (current version loaded from /Users/raarts/.mix/archives/phx_new/phx_new/ebin/Elixir.Mix.Tasks.Phx.New.Ecto.beam)
lib/mix/tasks/phx.new.ecto.ex:1
warning: redefining module Phx.New.Generator (current version loaded from /Users/raarts/.mix/archives/phx_new/phx_new/ebin/Elixir.Phx.New.Generator.beam)
lib/phx_new/generator.ex:1
warning: redefining module Mix.Tasks.Phx.New (current version loaded from /Users/raarts/.mix/archives/phx_new/phx_new/ebin/Elixir.Mix.Tasks.Phx.New.beam)
lib/mix/tasks/phx.new.ex:1
warning: redefining module Phx.New.Single (current version loaded from /Users/raarts/.mix/archives/phx_new/phx_new/ebin/Elixir.Phx.New.Single.beam)
lib/phx_new/single.ex:1
warning: redefining module Phx.New.Umbrella (current version loaded from /Users/raarts/.mix/archives/phx_new/phx_new/ebin/Elixir.Phx.New.Umbrella.beam)
lib/phx_new/umbrella.ex:1
warning: redefining module Phx.New.Web (current version loaded from /Users/raarts/.mix/archives/phx_new/phx_new/ebin/Elixir.Phx.New.Web.beam)
lib/phx_new/web.ex:1
== Compilation error in file lib/phx_new/ecto.ex ==
** (File.Error) could not read file "/Users/chris/oss/phoenix/installer/templates/phx_ecto/repo.ex": no such file or directory
(elixir) lib/file.ex:319: File.read!/1
lib/phx_new/generator.ex:28: anonymous fn/4 in Phx.New.Generator."MACRO-__before_compile__"/2
(elixir) lib/enum.ex:1925: Enum."-reduce/3-lists^foldl/2-0-"/3
lib/phx_new/generator.ex:24: anonymous fn/3 in Phx.New.Generator."MACRO-__before_compile__"/2
(elixir) lib/enum.ex:1925: Enum."-reduce/3-lists^foldl/2-0-"/3
expanding macro: Phx.New.Generator.__before_compile__/1
lib/phx_new/ecto.ex:1: Phx.New.Ecto (module)
Sorry, had to uninstall the other first:
mix archive.uninstall phx_new
Most helpful comment
The phx_new archive can now be installed via hex, which will prevent this issue. For example: