hexpm / hex

Package manager for the Erlang ecosystem.
https://hex.pm
972 stars 184 forks source link

Hex.Solver.Constraint included in mix releases #983

Closed fhunleth closed 1 year ago

fhunleth commented 1 year ago

After upgrading from Hex 1.0 to Hex 2.0.x, there's an UndefinedFunctionError that prevents use of the IEx i/1 helper in Mix releases. It looks like this:

iex(1)> i 4
** (UndefinedFunctionError) function Hex.Solver.Constraint.impl_for/1 is undefined (module Hex.Solver.Constraint is not available)
    Hex.Solver.Constraint.impl_for(4)
    (iex 1.14.3) lib/iex/helpers.ex:526: anonymous fn/2 in IEx.Helpers.all_implemented_protocols_for_term/1
    (elixir 1.14.3) lib/enum.ex:4313: Enum.reject_list/2
    (iex 1.14.3) lib/iex/helpers.ex:526: IEx.Helpers.all_implemented_protocols_for_term/1
    (iex 1.14.3) lib/iex/helpers.ex:507: IEx.Helpers.i/1
    iex:1: (file)

To reproduce, create a new Elixir project, run mix release.init and mix release. Then start the release with start_iex.

This issue affects Elixir 1.14, but not Elixir main. I don't see the commit that fixed it in main from a quick review of updates. Hex 1.0 is fine since it does have the Hex.Solver.Constraint module at all. Running mix local.hex 1.0.1 to downgrade seems to be an ok work around for the time being.

The fix could be to update to Elixir 1.15 when it's released. I put this here since I didn't see it logged anywhere else, and wanted to make it easier to find for others who hit it.

fhunleth commented 1 year ago

Thanks!!!

ericmj commented 1 year ago

Thanks @josevalim!