(Mix) Could not invoke task "release"

Today I tried to make new release of a long time not touched Phoenix app which I needed to make adjustments to and couldn’t because after I issue the command:

mix edeliver build release

it gives me an error:

using mix to generate release
** (Mix) Could not invoke task "release": 3 errors found!
--verbose : Unknown option
--env : Unknown option
--name : Unknown option

Output of the command is shown above and the command executed
on that host is printed below for debugging purposes:

FAILED with exit status 1:

    [ -f ~/.profile ] && source ~/.profile
    set -e
    cd /home/build/apps/jp/builds
    if [ "mix" = "rebar" ]; then
      echo "using rebar to generate release"
      ./rebar   -f generate
    elif [ "mix" = "relx" ]; then
      echo "using relx to generate release"
      ./relx release
    elif [ "mix" = "mix" ]; then
      echo "using mix to generate release"
      MIX_ENV="prod" LINK_SYS_CONFIG="" LINK_VM_ARGS="" APP="jp" AUTO_VERSION="" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix  release --verbose --env="prod" --name="jp"

I changed nothing serious in the app, just a few tweaks in templates. It worked before with no problem.

What can I do with the problem? I’ve looked in the mix’s docs and release command options seem to be valid for current version of mix.

What version of edeliver, distiller(?), Elixir according to your lockfile!

Ubuntu 18.04
Erlang/OTP 22 [erts-10.7.1]

Elixir 1.10.2 (compiled with Erlang/OTP 21)
Mix 1.10.2 (compiled with Erlang/OTP 21)


"distillery": {:hex, :distillery, "2.0.12", "6e78fe042df82610ac3fa50bd7d2d8190ad287d120d3cd1682d83a44e8b34dfb", [:mix], [{:artificery, "~> 0.2", [hex: :artificery, repo: "hexpm", optional: false]}], "hexpm"},
"edeliver": {:hex, :edeliver, "1.6.0", "8bfdde1b7ff57deb12fa604c4087b4e15a7aa72d7b3d3d310602ca92c038f3ff", [:mix], [{:distillery, "~> 2.0", [hex: :distillery, repo: "hexpm", optional: true]}], "hexpm"}
```Preformatted text

Distillery 2.0 can’t work with elixir 1.9+. Edeliver probably needs to get updated as well to be able with distillery 2.1 or newer/elixir 1.9 and newer.

Thanks, I’ll try it out. Just wondering why the error is so misleading?

Because Distillery used to have the command mix release but now that is builtin to Elixir. So it tries to call Elixir’s release task but give it the arguments that work for Distillery’s release task. So it complains about unknown options.

Distillery’s command is nowadays named mix distillery.release.

1 Like

Thanks for clarification! (Everything changes…)

Ok, so I’ve updated edeliver and distillery and got another error:

-----> Generating release
using mix to generate release
==> Loading configuration..
** (Distillery.Releases.Config.LoadError) could not load release config rel/config.exs
    ** (CompileError) nofile:10: module Mix.Releases.Config is not loaded and could not be found
    (elixir 1.10.2) expanding macro: Kernel.use/2
    nofile:10: (file)

What is to be done now to update old release?

I’ve found the issue https://github.com/bitwalker/distillery/issues/700
Seems I need to replace Mix.Releases.Config with Distillery.Releases.Config
I’ll give it a try and report…

So yes, after upgrading distillery and edeliver and changing one line in rel/config.exs file from
release was made and deployed.

The problem was that at some point I’ve upgraded elixir language to the latest version on my Ubuntu build server but it came with changes which touched the way distillery package works.

Thanks one more time for all you, guys!