4

我缺少 Phoenix 特定的混合任务,例如 mix phoenix.gen.html

$ 混合帮助 | grep -i 凤凰

mix local.phoenix # 本地更新 Phoenix

mix phoenix.new # 创建一个新的 Phoenix v1.2.1 应用

$混合-v

Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

混合 1.3.4

$长生不老药-v

Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

灵丹妙药 1.3.4

我已经在我的 Mac 上重新安装了 Erlang、Node、Elixir、Phoenix(使用 brew),但似乎没有任何东西可以解决这个问题。

这是从 Phoenix 应用程序目录运行它的输出

$ mix phoenix.new hello

$ cd hello

$ ls
README.md       brunch-config.js    deps            mix.exs            node_modules     priv            web _build          config          lib         mix.lock        package.json        test

$ mix -h | fgrep phoenix
mix local.phoenix     # Updates Phoenix locally
mix phoenix.new       # Creates a new Phoenix v1.2.1 application
4

1 回答 1

8

local.phoenix除了和phoenix.new之外的所有任务phoenix.gen.html都只能在 Phoenix 应用程序的目录中使用。mix help如果您从应用程序的目录中运行它,您应该会看到它们。

mix compile注意:如果您想看到它出现在mix help从未编译过的全新应用程序中,则必须编译该应用程序一次。但是,如果您直接运行其中一项任务,它将成功,因为mix将在尝试运行应用程序之前对其进行编译。

在任何应用程序的目录之外:

$ mix help | grep phoenix
mix local.phoenix     # Updates Phoenix locally
mix phoenix.new       # Creates a new Phoenix v1.2.1 application

在应用程序的目录中(确保应用程序通过mix compile先运行编译):

$ mix help | grep phoenix
mix local.phoenix        # Updates Phoenix locally
mix phoenix.digest       # Digests and compress static files
mix phoenix.gen.channel  # Generates a Phoenix channel
mix phoenix.gen.html     # Generates controller, model and views for an HTML based resource
mix phoenix.gen.json     # Generates a controller and model for a JSON based resource
mix phoenix.gen.model    # Generates an Ecto model
mix phoenix.gen.presence # Generates a Presence tracker
mix phoenix.gen.secret   # Generates a secret
mix phoenix.new          # Creates a new Phoenix v1.2.1 application
mix phoenix.routes       # Prints all routes
mix phoenix.server       # Starts applications and their servers
于 2016-10-14T04:29:28.153 回答