Mix task "release" not found error

mix task aliases
elixir mix
mix compile
mix docs
elixir optionparser
mix the task could not be found
mix hex docs
elixir command line arguments

I was setting up an Ubuntu 16.04 server for my Elixir/Phoenix application with edeliver when edeliver failed with the error message ** (Mix) The task "release" could not be found along with a exit code of 1. If I go to my build server, git pull my app and run MIX_ENV=prod mix release or just mix release after getting dependencies, I get the same error.

However, the same application works without any problem locally.

My erlang version is erts-9.0 and elixir version is 1.5.5 on both the server and my local computer. Hex version is also the same at 0.16.1.

Phoenix was installed using this command: mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez.

This is my mix.exs file.

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

My edeliver configuration file .deliver/config is as follows:

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: point your branch explicitly and make sure, that folder /rel/ under git and committed:

$ mix edeliver build release --branch=feature/deploy

I had similar error: ** (Mix) The task "release" could not be found and when I tried to find a solution, this unresolved discussion got my attention several times. I realized, that mix task release is in the /rel/config.exs. And if you use command $ mix edeliver build release as mentioned in literally all tutorials, edeliver gets master branch version (no matter from what branch you try to build).

Mix.Tasks.Run – Mix v1.0.5, Mix v1.0.5 Mix.Tasks.Run. Runs the given file or expression in the context of the application. Before running the code, it invokes the app.start task which  A Mix application defines a set of credentials that you use to access Mix.asr, Mix.nlu, and Mix.dialog resources. A Mix application can be deployed to multiple runtime environments (for example, sandbox, QA, production, etc.). By default, each user has a personal namespace (identified with the email address), which includes an application.

As far as I can see, you are using edeliver to deliver the application to the server. Why would you run anything from the server then?

Also, where release task should come from? I believe, you did mean something like:

mix edeliver build release
mix edeliver deploy release to production
mix edeliver restart production

which is the standard flow to build, deploy and restart production with edeliver. Unfortunately, the three commands above won’t work out of the box as well, and you will need to explicitly setup edeliver for phoenix project (there are many good tutorials all around.)

Custom Mix Tasks · Elixir School, Creating custom Mix tasks for your Elixir projects. Table of Contents. Introduction; Setup; Custom Mix Task; Mix Tasks in Action. Introduction. It's not  Writing a Mix task is reasonably straightforward with only a few steps: If you want to create a mix task called “echo” then create a module called Mix.Tasks.Echo. The task name seen in mix Add use Mix.Task to this module. Write a public method called run. It has the type signature: run (

The problem I had was I forgot to push the latest changes to git which it does fetch the source from. So after adding the edeliver it couldnt find any of the files its generated. By pushing it to git it now works for me.

Mix Task Creation in Elixir Project - blackode, This article explains about creating the custom mix tasks and documenting the created task . Here, we fly in the space of Elixir to create mix  Let’s Create a Task Create a new project. Create Task directory. After creating the project, go to your lib directory and create one nested directory as mix/tasks Task Testing Module Files. Now, we will create two files in lib directory one hello.ex and other one is hi.ex with some hello.ex.

Writing Mix Tasks for Fun and Profit. - Def Method Works, I'm beginning to learn a little Elixir & Phoenix and I ran into a case where I wish I had a Mix task for something. Specifically I wanted to run npm  $ mix help mix # Runs the default task (current: "mix run") mix app.start # Starts all registered apps mix archive # Lists all archives mix archive.build # Archives this project into a .ez file mix archive.install # Installs an archive locally mix archive.uninstall # Uninstalls archives mix clean # Deletes generated application files mix cmd # Executes the given command mix compile # Compiles source files mix deps # Lists dependencies and their status mix deps.clean # Deletes the given

Creating custom Mix tasks - Elixir Cookbook, Fortunately, Mix allows the creation of customized tasks that integrate as if they were shipped with Mix itself. In this recipe, we will create a custom Mix task that will  New to Elixir but loving it so far :) A lot of my mix tasks depend on HTTPotion. My mix.exs file is declared as such def application do [ applications: [:logger, :cowboy, :plug, :htt

How do I run a mix task from within a mix task?, Shell is the redundant link here. If you want to run edeliver task, run Mix.Tasks.​Edeliver#run : def run(_) do Mix.Tasks.Edeliver.run(~w|build  Mix is a build tool that ships with Elixir that provides tasks for creating, compiling, testing your application, managing its dependencies and much more; ExUnit is a test-unit based framework that ships with Elixir; In this chapter, we will create our first project using Mix and explore different features in OTP, Mix and ExUnit as we go.

Comments
  • When I run mix edeliver build release the command fails. Edeliver outputs the same error message. To investigate, I manually did the build process and bumped into the same error as edeliver.
  • I am not sure I get how edeliver could output the same error message when running locally. The whole mix edeliver build release is the single mix task, named edeliver, being run with two parameters. If you manually did the build, there is no mix at all available on the target host, the build is a tar containing the compiled content.
  • Let me paraphrase myself. Since the edeliver build command can't succeed in my development machine, I ssh-ed into the build server and manually typed the commands edeliver would perform. I get the same task not found error. This rules out the possibility that something is wrong with edeliver. My hunch is that the error has got something to do with the server configuration which I'm not aware of.
  • "edeliver build command can't succeed in my development machine"—with what error message? Also, please show your .deliver/config.
  • The edeliver error message is also ** (Mix) The task "release" could not be found along with FAILED with exit status 1. I'll now update the question to show my ./deliver/config.
  • This didn't work. I went to reset the server to a clean Ubuntu installation and install everything again. It started working.