nats-io / elixir-nats

Elixir NATS client
MIT License
76 stars 14 forks source link

Failed to compile the application with natsio from hex #46

Closed psylone closed 5 years ago

psylone commented 6 years ago

Getting the could not find an app file at "_build/dev/lib/natsio/ebin/natsio.app". error during the compilation of the mix application.

Steps to reproduce

  1. Create a new mix application:

    mix new hello_nats && cd hello_nats
  2. Add natsio dependency from hex in the mix.exs file:

    # Part of the mix.exs file
    defp deps do
    [
      {:natsio, "~> 0.1.6"}
    ]
    end
  3. Get all dependencies:

    mix deps.get
  4. Compile the application:

    mix compile

Error log

Generated nats app
==> hello_nats
Unchecked dependencies for environment dev:
* natsio (Hex package)
  could not find an app file at "_build/dev/lib/natsio/ebin/natsio.app". This may happen if the dependency was not yet compiled, or you specified the wrong application name in your deps, or the dependency indeed has no app file (then you can pass app: false as option)
** (Mix) Can't continue due to errors on dependencies

I believe that's because the application itself is called nats rather than natsio. Since there's no supervision tree inside the nats app, we can add dependency option app: false which will prevent mix application from reading nats app file:

# Part of the mix.exs file
  defp deps do
    [
      {:natsio, "~> 0.1.6", app: false}
    ]
  end

If it helps, probably we can drop a line about it in the docs.

psylone commented 5 years ago

Sorry, my bad. The correct way is to use :hex option:

defp deps do
  [{:nats, "~> 0.1.6", hex: :natsio}]
end

But, probably it's still a good idea to change it in the README.

ColinSullivan1 commented 5 years ago

Thank you all for using NATS! Note that this client has largely been unmaintained and so has been deprecated. Moving forward we suggest you migrate to the nats.ex client which will be actively maintained. We'll keep this repository public in case you'd prefer to make a copy to maintain yourselves, but hope you'll have a good experience with the new client. We sincerely apologize for the inconvenience.