kipcole9 / money

Elixir implementation of Money with Currency
https://hex.pm/packages/ex_money
Other
572 stars 48 forks source link

could not find an app file at "_build/dev/lib/ex_money/ebin/ex_money.app" #121

Closed niccolox closed 3 years ago

niccolox commented 3 years ago

I am getting this on Mac and Ubuntu

Unchecked dependencies for environment dev:
* ex_money (Hex package)
  could not find an app file at "_build/dev/lib/ex_money/ebin/ex_money.app". This may happen if the dependency was not yet compiled 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

mix.exs

      {:ex_money, "~> 5.4"},

applications

      :ex_money,

versions

elixir -v
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe]

Elixir 1.10.2 (compiled with Erlang/OTP 22)
kipcole9 commented 3 years ago

I suspect that having ex_money in your applications: [....] list may be the issue. These days you shouldn't need to do anything except add it to deps.

Would you mind removing ex_money from applications and trying again?

niccolox commented 3 years ago

OK, did that and get the same error first time I try mix phx.server, second time I restart it runs

  866  MIX_ENV=dev mix deps.clean --all
  867  MIX_ENV=dev mix deps.get --all
  868  MIX_ENV=dev iex -S mix phx.server

errors

  874  MIX_ENV=dev iex -S mix phx.server

works
kipcole9 commented 3 years ago

Thats unusual and I haven't seen it before, apologies that you're treading a new path. I'll keep the issue open for a while in case you see a reoccurence.

niccolox commented 3 years ago

thanks, closing

phil-a commented 3 years ago

Seeing this issue, but for me it only showed up for me when running MIX_ENV=prod mix compile and getting the following:

Generated ex_money_sql app
==> phoenix_ecto
Compiling 7 files (.ex)
Generated phoenix_ecto app
==> <your-app-name>
Unchecked dependencies for environment prod:
* ex_money (Hex package)
  could not find an app file at "_build/prod/lib/ex_money/ebin/ex_money.app". This may happen if the dependency was not yet compiled 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

It happens the first time when I run mix.compile, but if I re-run it a second time it compiles successfully. Running Elixir 1.12.0 (compiled with Erlang/OTP 22)

kipcole9 commented 3 years ago

Thats very strange. ex_money is definitely a dependency and yet its not being compiled (it should compile before ex_money_sql). Any chance your repo is public so I can try to reproduce and debug? Does it in fact compile ex_money first (your snippet above seems to be cut after the start of the compilation run)?

phil-a commented 3 years ago

It is not public, but I shared the private repo with you (it's a WIP needs a bit of cleanup). I followed along during the compilation and it doesn't look like it compiles ex_money at all on the first run. I can see __build/prod/lib/ex_money_sql/ebin/ex_moneysql.app is built, but not __build/prod/lib/ex_money/ebin/exmoney.app

The following gist shows a dokku build, but getting the same error building prod locally as well: https://gist.github.com/phil-a/cab67e3ff7e237167ad601e7cffc2dbf

Let me know if I can help in any way!

kipcole9 commented 3 years ago

Looking at the log of the gist you sent (thanks, very helpful) I think the issue is related to your mix.exs configuration which has:

      {:money, "~> 1.8"},
      {:ex_money_sql, "~> 1.0"},
      {:ex_cldr, "~> 2.0"},
      {:ex_money_sql, "~> 1.0"},

Any chance you could give that a try and see if you see the error still?

phil-a commented 3 years ago

Think this was related to same issue as #128 (or at least the same solution). After I made that change I've rebuilt several times and have yet to see that error.