Ecto not working when Compile

I try learn in Ecto Book Programming Ecto Build Database Apps in Elixir for Scalability and Performance 2019, but for the first time its showing error and warning like below :

    warning: use Mix.Config is deprecated. Use the Config module instead
    │
 11 │ use Mix.Config
    │ ~~~~~~~~~~~~~~
    │
    └─ config/config.exs:11

    warning: Mix.Config.config/3 is deprecated. Use the Config module instead
    │
 32 │ config :music_db, :ecto_repos, [MusicDB.Repo]
    │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ config/config.exs:32

    warning: Mix.Config.config/3 is deprecated. Use the Config module instead
    │
 34 │ config :music_db, MusicDB.Repo,
    │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ config/config.exs:34

    warning: Mix.Config.import_config/1 is deprecated. Use the Config module instead
    │
 44 │ import_config "#{Mix.env}.exs"
    │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ config/config.exs:44

    warning: use Mix.Config is deprecated. Use the Config module instead
    │
  9 │ use Mix.Config
    │ ~~~~~~~~~~~~~~
    │
    └─ config/dev.exs:9

==> decimal
Compiling 4 files (.ex)
      warning: using single-quoted strings to represent charlists is deprecated.
      Use ~c"" if you indeed want a charlist or use "" instead.
      You may run "mix format --migrate" to change all single-quoted
      strings to use the ~c sigil and fix this warning.
      │
 1320 │           '0.' ++ :lists.duplicate(-diff, ?0) ++ list
      │           ~
      │
      └─ lib/decimal.ex:1320:11

      warning: using single-quoted strings to represent charlists is deprecated.
      Use ~c"" if you indeed want a charlist or use "" instead.
      You may run "mix format --migrate" to change all single-quoted
      strings to use the ~c sigil and fix this warning.
      │
 1351 │           list = list ++ 'E'
      │                          ~
      │
      └─ lib/decimal.ex:1351:26

      warning: using single-quoted strings to represent charlists is deprecated.
      Use ~c"" if you indeed want a charlist or use "" instead.
      You may run "mix format --migrate" to change all single-quoted
      strings to use the ~c sigil and fix this warning.
      │
 1352 │           list = if exp >= 0, do: list ++ '+', else: list
      │                                           ~
      │
      └─ lib/decimal.ex:1352:43

      warning: using single-quoted strings to represent charlists is deprecated.
      Use ~c"" if you indeed want a charlist or use "" instead.
      You may run "mix format --migrate" to change all single-quoted
      strings to use the ~c sigil and fix this warning.
      │
 1775 │       int = if int == [], do: '0', else: int
      │                               ~
      │
      └─ lib/decimal.ex:1775:31

      warning: using single-quoted strings to represent charlists is deprecated.
      Use ~c"" if you indeed want a charlist or use "" instead.
      You may run "mix format --migrate" to change all single-quoted
      strings to use the ~c sigil and fix this warning.
      │
 1776 │       exp = if exp == [], do: '0', else: exp
      │                               ~
      │
      └─ lib/decimal.ex:1776:31

Generated decimal app
==> jason
Compiling 10 files (.ex)
Generated jason app
==> ecto
Compiling 54 files (.ex)
      warning: missing parentheses for expression following "do:" keyword. Parentheses are required to solve ambiguity inside keywords.

      This error happens when you have function calls without parentheses inside keywords. For example:

          function(arg, one: nested_call a, b, c)
          function(arg, one: if expr, do: :this, else: :that)

      In the examples above, we don't know if the arguments "b" and "c" apply to the function "function" or "nested_call". Or if the keywords "do" and "else" apply to the function "function" or "if". You can solve this by explicitly adding parentheses:

          function(arg, one: if(expr, do: :this, else: :that))
          function(arg, one: nested_call(a, b, c))

      Ambiguity found at:
      │
 2640 │     raise ArgumentError, "cannot add constraint to changeset because it does not have a source, got: #{inspect data}"
      │     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      │
      └─ lib/ecto/changeset.ex:2640

     warning: atom ::: must be written between quotes, as in :"::", to avoid ambiguity
     │
 203 │       {:::, _, [left, _]} -> is_integer(left) or is_binary(left)
     │        ~
     │
     └─ lib/ecto/query/builder.ex:203:8

     warning: unknown compiler variable "__" (expected one of __MODULE__, __ENV__, __DIR__, __CALLER__, __STACKTRACE__)
     │
 853 │   def quoted_type({:datetime_add, _, [_, _, __]}, _vars), do: :naive_datetime
     │                                             ~~
     │
     └─ lib/ecto/query/builder.ex:853:45: Ecto.Query.Builder.quoted_type/2

     warning: unknown compiler variable "__" (expected one of __MODULE__, __ENV__, __DIR__, __CALLER__, __STACKTRACE__)
     │
 854 │   def quoted_type({:date_add, _, [_, _, __]}, _vars), do: :date
     │                                         ~~
     │
     └─ lib/ecto/query/builder.ex:854:41: Ecto.Query.Builder.quoted_type/2

     warning: missing parentheses for expression following "do:" keyword. Parentheses are required to solve ambiguity inside keywords.

     This error happens when you have function calls without parentheses inside keywords. For example:

         function(arg, one: nested_call a, b, c)
         function(arg, one: if expr, do: :this, else: :that)

     In the examples above, we don't know if the arguments "b" and "c" apply to the function "function" or "nested_call". Or if the keywords "do" and "else" apply to the function "function" or "if". You can solve this by explicitly adding parentheses:

         function(arg, one: if(expr, do: :this, else: :that))
         function(arg, one: nested_call(a, b, c))

     Ambiguity found at:
     │
 520 │     do: raise ArgumentError, "a changeset with action #{inspect given} was given to #{inspect repo}.#{action}/2"
     │     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     │
     └─ lib/ecto/repo/schema.ex:520


== Compilation error in file lib/ecto/query.ex ==
** (Kernel.TypespecError) lib/ecto/query.ex:400: type dynamic/0 is a built-in type and it cannot be redefined
    (elixir 1.18.3) lib/kernel/typespec.ex:980: Kernel.Typespec.compile_error/2
    (stdlib 6.2.2) lists.erl:2151: :lists.foldl_1/3
    (elixir 1.18.3) 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"

I had make steps:

  1. mix ecto.setup
  2. mix compile
  3. mix deps.clean ecto
  4. mix deps.get
  5. mix deps.compile ecto

but still not working and showing error like above

I am sorry, i have solved it
I just update my Dependency
mix deps.update --all
then
mix deps.compile ecto

Now solved

2 Likes