Morningstar88 / how-can-we-fix

Collaborative Fixing
MIT License
0 stars 0 forks source link

mix ecto.create returns: == Compilation error in file web/views/document_view.ex == #1

Open Morningstar88 opened 5 years ago

Morningstar88 commented 5 years ago

== Compilation error in file web/views/document_view.ex == ** (BadMapError) expected a map, got: {:safe, ""} (eex) lib/eex/engine.ex:161: EEx.Engine.handle_begin/1 (eex) lib/eex/compiler.ex:54: EEx.Compiler.generate_buffer/4 (phoenix) lib/phoenix/template.ex:378: Phoenix.Template.compile/2 (phoenix) lib/phoenix/template.ex:186: anonymous fn/3 in Phoenix.Template."MACRO-before_compile"/2 (elixir) lib/enum.ex:1940: Enum."-reduce/3-lists^foldl/2-0-"/3 (phoenix) expanding macro: Phoenix.Template.before_compile/1 web/views/document_view.ex:1: AlchemyBook.DocumentView (module) (elixir) lib/kernel/parallel_compiler.ex:208: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

*

Could be caused by an Elixir version conflict, May also be an error with cloud9 IDE.

Possible solutions:

https://elixirforum.com/t/update-elixir-from-1-7-4-to-1-8-0/19589/3

First try doing rm -rf _build and then recompiling.

Correct. mix still has some bugs that don’t replace _build when it should, this is always a good starting point.

The cause of the issue is not in the module, but in one of the templates, which is compiled into the module (or at least should be).

To be more precise, I believe the bug is actually in the template engine. They may have been relying on some assumptions about how EEx works that may no longer be true in v1.8.

The bug is not in your template. Your template is fine. The bug is in whatever is compiling your templates. Probably in your e-mail handling library. Maybe updating the version will fix it. Your solution is fine, as it circumvents the issue, but at first there is nothing wrong with your template.

https://elixirforum.com/t/how-to-get-the-call-stack-stack-trace-at-any-point-in-code/2787

https://github.com/elixir-lang/elixir/ssiues/8790

Morningstar88 commented 5 years ago

In Elixir 1.8 the internals of the EEx engine have been changed in a way that was meant to be backwards compatible (since downstream projects shouldn't be relying on the internals). I am highlighting this issue in the hope that there is some way to improve the error message in Elixir itself. I've written a longer write-up in the phoenix_html project: phoenixframework/phoenix_html#247

Morningstar88 commented 5 years ago

Elixir Stacktrace

https://elixirforum.com/t/how-to-get-the-call-stack-stack-trace-at-any-point-in-code/2787/3

Process.info(self(), :current_stacktrace)

 :erlang.get_stacktrace/0.
Morningstar88 commented 5 years ago

Debugging

https://elixir-lang.org/getting-started/debugging.html

def some_fun(a, b, c) do
require IEx; IEx.pry
  ...
end
Morningstar88 commented 5 years ago

rm -rf _build

returns:

** (BadMapError) expected a map, got: {:safe, [{:|, [], ["", "

New User

\n\n"]}]}

Morningstar88 commented 5 years ago

https://stackoverflow.com/questions/47708302/badmaperror-elixir-phoenix

Morningstar88 commented 5 years ago

Error with Config File?

https://github.com/apognu/unicli/issues/1

Morningstar88 commented 4 years ago

August 8th 2020: Stack Overflow Answer

https://stackoverflow.com/questions/31720200/compilation-error-on-file-lib-phoenix-ecto-html-ex

Morningstar88 commented 4 years ago

Add Linguist to deps?

https://github.com/phoenixframework/phoenix/issues/540