elixir-ecto / ecto_sql

SQL-based adapters for Ecto and database migrations
https://hexdocs.pm/ecto_sql
Apache License 2.0
578 stars 312 forks source link

could not compile dependency :ecto, "mix compile" failed #623

Closed Rauulll closed 4 months ago

Rauulll commented 4 months ago

Elixir version

elixir 1.14.4-otp-24

Database and Version

16.3

Ecto Versions

ecto "~> 3.7.0" and ecto_sql "~> 3.7.1"

Database Adapter and Versions (postgrex, myxql, etc)

postgrex "~> 0.16.4" and myxql "~> 0.4.5"

Current behavior

`def project do [ app: :automzero, version: app_version(), elixir: "~> 1.5", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, aliases: aliases(), deps: deps(), releases: [ automzero: [ applications: [automzero: :permanent], include_erts: true, include_src: false, steps: [:assemble, :tar] ] ] ] end

defp deps do [

override because scrivener_html ~> 1.8 requires phoenix < 1.5.0

  {:phoenix, "~> 1.6.0", override: true},
  {:phoenix_pubsub, "~> 2.0"},
  {:phoenix_ecto, "~> 4.4.3"},
  {:ecto, "~> 3.7.0", override: true},
  {:ecto_sql, "~> 3.7.1", override: true},
  {:postgrex, ">= 0.0.0"},
  {:phoenix_html, "~> 3.0", override: true},
  {:phoenix_live_view, "~> 0.16.4"},
  {:phoenix_live_reload,
   git: "https://github.com/phoenixframework/phoenix_live_reload.git",
   branch: "master",
   only: :dev},
  {:gettext, "~> 0.11"},
  {:jason, "~> 1.0"},
  {:plug_cowboy, "~> 2.3.0"},
  {:plug_crypto, "~> 1.0", override: true},
  {:scrivener_ecto, "~> 2.0"},
  {:poison, "~> 3.1"},
  {:phauxth, "~> 2.0"},
  {:bcrypt_elixir, "~> 1.1"},
  {:timex, "~> 3.7"},
  {:thesis, "~> 0.3.4"},
  {:hashids, "~> 2.0"},
  {:distillery, "~> 2.0"},
  {:canada, "~> 1.0.1"},
  {:ecto_autoslug_field, "~> 2.0.1"},
  {:httpoison, "~> 1.8"},
  {:liquid, github: "steveops/liquid-elixir"},
  {:pdf_generator, ">=0.6.0"},
  {:scrivener_html, "~> 1.8"},
  {:mox, "~> 0.5", only: :test},
  {:honeydew, "~> 1.5.0"},
  {:arc, "~> 0.11.0"},
  {:flow, "~> 0.14"},
  {:ex_machina, "~> 2.3", only: :test},
  {:barlix, "~> 0.4.0"},
  {:eqrcode, "~> 0.1.8"},
  {:broadway, "~> 0.4.0"},
  {:myxql, "~> 0.4.0"},
  {:phoenix_live_dashboard, "~> 0.5"},
  {:telemetry_metrics, "~> 0.6"},
  {:telemetry_poller, "~> 0.5"},
  {:number, "~> 1.0.1"},
  {:recase, "~> 0.2"},
  {:cachex, "~> 3.6"},
  {:bureaucrat, "~> 0.2.7"},
  {:corsica, "~> 1.0"},
  {:money, "~> 1.4"},
  {:bamboo, "~> 1.0", override: true},
  {:bamboo_smtp, "~> 3.1.3"},
  {:css_parser, ">= 0.1.0"},
  {:phoenix_markdown, "~> 1.0"},
  {:csv, "~> 2.4"},
  {:xlsxir, "~> 1.6.4"},
  {:erlsom, "~> 1.5"},
  {:abacus, "~> 2.0.0"},
  {:ex_crypto, "~> 0.10.0"},
  {:sentry, "~> 8.0"},
  {:oauth2, "~> 2.0"},
  {:nimble_csv, "~> 1.2.0"}
]

end `

mix deps.get mix iex -S mix phx.server

Error i'm getting:

== Compilation error in file lib/ecto/query.ex == ** (Kernel.TypespecError) lib/ecto/query.ex:428: type dynamic/0 is a built-in type and it cannot be redefined (elixir 1.15.7) lib/kernel/typespec.ex:961: Kernel.Typespec.compile_error/2 (stdlib 5.2.3.1) lists.erl:1599: :lists.foldl_1/3 (elixir 1.15.7) lib/kernel/typespec.ex:226: Kernel.Typespec.translate_typespecs_for_module/2 could not compile dependency :ecto, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile ecto --force", update it with "mix deps.update ecto" or clean it with "mix deps.clean ecto"

Expected behavior

Project to launch server but running into :ecto error.

josevalim commented 4 months ago

Recent Erlang versions introduced a dynamic() type that conflicted with Ecto types. You need to update your Ecto.

Rauulll commented 4 months ago

but wouldn't it mean that earlier versions of Erlang would still compile. I'm using asdf to manage my project so as to carter for such conflicts.

josevalim commented 4 months ago

Which Erlang version do you see when you run “iex”?

Rauulll commented 4 months ago

Erlang/OTP 24 [erts-12.3.2.16] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

josevalim commented 4 months ago

It seems there is something wrong with your Erlang installation. Probably two different Erlangs were installed in the same directory.

you can see in your error message that the stdlib app in Erlang is 5.2, but the latest stdlib version for Erlang 24 is 3.x: https://github.com/erlang/otp/blob/maint-24/lib/stdlib/vsn.mk

which is why you see an error. Somewhere you have s more recent Erlang version.

Rauulll commented 4 months ago

when i run erl on root directory what is returned is

Erlang/OTP 26 [erts-14.2.5.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

which uses stdlib 5.2. But wheb i run it on project dir, it states it's using otp 24, i guess the asdf versions are being honoured. I'll look into it.