bitwalker / distillery

Simplify deployments in Elixir with OTP releases!
MIT License
2.96k stars 398 forks source link

Missing dependency causes nil.name() error #556

Closed kanishkablack closed 5 years ago

kanishkablack commented 5 years ago

Steps to reproduce

mix release

Verbose Logs

==> Release failed: function nil.name/0 is undefined

    nil.name()
    (distillery) lib/mix/lib/releases/models/release.ex:532: Mix.Releases.Release.do_add_app/4
    (distillery) lib/mix/lib/releases/models/release.ex:547: Mix.Releases.Release.do_add_children/4
    (distillery) lib/mix/lib/releases/models/release.ex:507: Mix.Releases.Release.add_apps/3
    (distillery) lib/mix/lib/releases/models/release.ex:476: Mix.Releases.Release.apps/1
    (distillery) lib/mix/lib/releases/models/release.ex:330: Mix.Releases.Release.apply_configuration/3
    (distillery) lib/mix/lib/releases/assembler.ex:28: Mix.Releases.Assembler.pre_assemble/1
    (distillery) lib/mix/lib/releases/assembler.ex:46: Mix.Releases.Assembler.assemble/1

Description of issue

ogreface commented 5 years ago

I am also seeing this.

ogreface commented 5 years ago

It seems adding a missing dependency fixes this. In my case, I had lager being included via config (and extra_application), but putting in the deps worked. Note that I had to set the distillery version to 1.5.5 to get a helpful error message about it. One I added the the dep, going back to distillery 2.0 worked just fine.

bitwalker commented 5 years ago

@ogreface Just FYI, but you can't put third-party dependencies in extra_applications, it is intended for "extra" standard library applications from Elixir or Erlang, e.g. logger or crypto. You can of course add third-party deps to that list, but it doesn't actually do anything, and can cause issues when tools don't expect it. In this case though, it seems like you didn't have the lager dependency in your deps list at all, which is why the error is a bit obtuse.

I'll add a TODO to make sure Distillery identifies this edge case. Thanks!

paridin commented 5 years ago

I fixed it removing a missing app, in the application function in mix.exs.

I forgot I experimented with Scrape. and I had extra_applications: [:scrape, :logger, :runtime_tools] just removes :scrape and it works. Hope help newcomers like me.

Its good to know this place is only for standard libraries from the ecosystem.

thanks.

ogreface commented 5 years ago

@bitwalker Great to know, thanks for the feedback!

fazibear commented 5 years ago

The problem still exists when you're using debian/ubuntu.

In my case, I've forgotten to install erlang-xmerl package and this kind of error appeared. To fix this you have to apt install erlang-xmerl. There was a few other missing packages: erlang-xmerl erlang-appmon erlang-os-mon.

The problem is that you simply don't know what package you're missing.

fazibear commented 5 years ago

I found one more case:

When you have an umbrella app in your deps, you'll get same error.

The solution is to just add runtime: false, but I've spent about an hour to figure it out.

fazibear commented 5 years ago

Attempt to fix this issue: https://github.com/bitwalker/distillery/pull/614

kanishkablack commented 5 years ago

Thanks for update

bitwalker commented 5 years ago

In general there is no way for us to tell you which package to install or something of that nature, we can only identify when an app is extraneous (i.e. it is in the list, but not on the code path).