[英]Mix task “release” not found error
當edeliver失敗並顯示錯誤消息** (Mix) The task "release" could not be found
時,我使用edeliver為我的Elixir / Phoenix應用程序設置了Ubuntu 16.04服務器。找不到** (Mix) The task "release" could not be found
,退出代碼為1。構建服務器,git拉我的應用程序並運行MIX_ENV=prod mix release
或者僅在獲得依賴項后才mix release
,我遇到相同的錯誤。
但是,同一應用程序可以在本地正常運行。
我的erlang版本是erts-9.0
,而服務器和本地計算機上的elixir版本都是1.5.5
。 十六進制版本也與0.16.1
相同。
使用以下命令安裝了Phoenix: mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
。
這是我的mix.exs
文件。
defmodule MyApp.Mixfile do
use Mix.Project
def project do
[
app: :MyApp,
version: "0.0.1",
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
start_permanent: Mix.env == :prod,
aliases: aliases(),
deps: deps()
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {MyApp.Application, []},
extra_applications: [:comeonin, :logger, :runtime_tools, :earmark, :distillery, :edeliver]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{:phoenix, "~> 1.3.0"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.2"},
{:mariaex, ">= 0.0.0"},
{:phoenix_html, "~> 2.10"},
{:comeonin, "~> 4.0"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:earmark, "~> 1.2.3"},
{:cowboy, "~> 1.0"},
{:edeliver, "~> 1.4.4"},
{:distillery, "~> 1.5.1"}
]
end
# Aliases are shortcuts or tasks specific to the current project.
# For example, to create, migrate and run the seeds file at once:
#
# $ mix ecto.setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
[
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
"test": ["ecto.create --quiet", "ecto.migrate", "test"]
]
end
end
我的edeliver配置文件.deliver/config
如下:
APP="MyApp"
BUILD_HOST="1.1.1.1"
BUILD_USER="ubuntu"
BUILD_AT="/home/ubuntu/app_build"
PRODUCTION_HOSTS="1.1.1.1"
PRODUCTION_USER="ubuntu"
DELIVER_TO="/home/ubuntu/app_release"
pre_erlang_get_and_update_deps() {
local _prod_secret_path="/home/ubuntu/app_config/prod.secret.exs"
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
ln -sfn '$_prod_secret_path' '$BUILD_AT/config/prod.secret.exs'
"
fi
}
TLDR:明確指向分支,並確保git下的/rel/
文件夾已提交:
$ mix edeliver build release --branch=feature/deploy
我有類似的錯誤: ** (Mix) The task "release" could not be found
,當我嘗試找到解決方案時,這個懸而未決的討論引起了我多次注意。 我意識到,混合任務release
在/rel/config.exs
。 而且,如果您按字面所有教程中所述使用命令$ mix edeliver build release
,則edeliver將獲得master
分支版本(無論您嘗試從哪個分支進行構建)。
據我edeliver
,您正在使用edeliver
將應用程序交付到服務器。 那為什么還要從服務器運行任何東西?
另外, release
任務應該來自哪里? 我相信,您的意思確實是這樣的:
mix edeliver build release
mix edeliver deploy release to production
mix edeliver restart production
這是使用edeliver
構建,部署和重新啟動生產的標准流程。 不幸的是,上面的三個命令也不是edeliver
可用的,您將需要為phoenix項目顯式設置edeliver
(到處都有很多很好的教程。)
我遇到的問題是我忘了將最新的更改推到git中,它確實從中獲取源代碼。 因此,在添加edeliver之后,它無法找到其生成的任何文件。 通過將其推送到git,現在對我有效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.