如果您在 Elixir 1.13 和 Phoenix 1.6.5 上运行,那么根据您提供的命令,应该有一个web_interface
和目录(我把该命令的输出放在下面)。在您使用类似的东西生成第一个 LiveView 视图之前,不会创建该目录web_interface_web
mix phx.new web_interface --live --no-ecto
live
mix phx.gen.live Accounts User users name:string age:integer
这看起来像旧版本的 Phoenix 或 Elixir。您可能在引用不同版本的 Elixir 或 Phoenix 的不同 shell 会话中生成了项目。另外,凤凰的哪个版本mix.exs
说的?
检查您的 Elixir 版本elixir --version
➜ projects$ elixir --version
Erlang/OTP 24 [erts-12.0.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
Elixir 1.13.0 (compiled with Erlang/OTP 24)
然后检查phx
您安装的软件包的版本mix archive
➜ projects$ mix archive
* hex-1.0.1
* phx_new-1.6.5
Archives installed at: /Users/cj1/.kiex/mix/archives/elixir-1.13.0
如果您需要重新安装 phx 包,请运行 ( mix archive.install hex phx_new
docs )
➜ projects$ mix archive.install hex phx_new
Resolving Hex dependencies...
Dependency resolution completed:
New:
phx_new 1.6.5
* Getting phx_new (Hex package)
All dependencies are up to date
Compiling 11 files (.ex)
Generated phx_new app
Generated archive "phx_new-1.6.5.ez" with MIX_ENV=prod
Are you sure you want to install "phx_new-1.6.5.ez"? [Yn] y
* creating /Users/cj1/.kiex/mix/archives/elixir-1.13.0/phx_new-1.6.5
这是我运行您拥有的命令时得到的:
➜ projects$ mix phx.new web_interface --live --no-ecto
* creating web_interface/config/config.exs
* creating web_interface/config/dev.exs
* creating web_interface/config/prod.exs
* creating web_interface/config/runtime.exs
* creating web_interface/config/test.exs
* creating web_interface/lib/web_interface/application.ex
* creating web_interface/lib/web_interface.ex
* creating web_interface/lib/web_interface_web/views/error_helpers.ex
* creating web_interface/lib/web_interface_web/views/error_view.ex
* creating web_interface/lib/web_interface_web/endpoint.ex
* creating web_interface/lib/web_interface_web/router.ex
* creating web_interface/lib/web_interface_web/telemetry.ex
* creating web_interface/lib/web_interface_web.ex
* creating web_interface/mix.exs
* creating web_interface/README.md
* creating web_interface/.formatter.exs
* creating web_interface/.gitignore
* creating web_interface/test/support/channel_case.ex
* creating web_interface/test/support/conn_case.ex
* creating web_interface/test/test_helper.exs
* creating web_interface/test/web_interface_web/views/error_view_test.exs
* creating web_interface/lib/web_interface_web/controllers/page_controller.ex
* creating web_interface/lib/web_interface_web/views/page_view.ex
* creating web_interface/test/web_interface_web/controllers/page_controller_test.exs
* creating web_interface/test/web_interface_web/views/page_view_test.exs
* creating web_interface/assets/vendor/topbar.js
* creating web_interface/lib/web_interface_web/templates/layout/root.html.heex
* creating web_interface/lib/web_interface_web/templates/layout/app.html.heex
* creating web_interface/lib/web_interface_web/templates/layout/live.html.heex
* creating web_interface/lib/web_interface_web/views/layout_view.ex
* creating web_interface/lib/web_interface_web/templates/page/index.html.heex
* creating web_interface/test/web_interface_web/views/layout_view_test.exs
* creating web_interface/lib/web_interface/mailer.ex
* creating web_interface/lib/web_interface_web/gettext.ex
* creating web_interface/priv/gettext/en/LC_MESSAGES/errors.po
* creating web_interface/priv/gettext/errors.pot
* creating web_interface/assets/css/phoenix.css
* creating web_interface/assets/css/app.css
* creating web_interface/assets/js/app.js
* creating web_interface/priv/static/robots.txt
* creating web_interface/priv/static/images/phoenix.png
* creating web_interface/priv/static/favicon.ico
Fetch and install dependencies? [Yn] y
* running mix deps.get
* running mix deps.compile
We are almost there! The following steps are missing:
$ cd web_interface
Start your Phoenix app with:
$ mix phx.server
You can also run your app inside IEx (Interactive Elixir) as:
$ iex -S mix phx.server