Attempting to learn Phoenix from a tutorial. Stumbled upon Phoenix: An Introduction to Elixir's Web Framework and thought I would give it a go. I’m at the part where
mix phx.server is ran after defining the first views, and I can’t get it to compile.
== Compilation error in file lib/my_project/foos.ex == ** (CompileError) lib/my_project/foos.ex:17: MyProject.Foos.Foo.__struct__/1 is undefined, cannot expand struct MyProject.Foos.Foo. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code (stdlib 3.17) lists.erl:1358: :lists.mapfoldl/3 (stdlib 3.17) lists.erl:1358: :lists.mapfoldl/3 (elixir 1.12.2) expanding macro: Kernel.|>/2
I’ve double checked the code, and I’m pretty sure I’ve faithfully adapted their code to my own Phoenix project. Is the blog’s code not compatible with newer versions of Phoenix (I’m using v1.6.15)?
I’m pretty confused on troubleshooting for Phoenix. For troubleshooting this: is there a way to individually compile / check the offending file, lib/my_project/foos/foo.ex, that defines the struct (it sounds like that’s where the actual problem is)? For the cyclical module usage, are there any automated ways to check if this is happening (off-topic, is there a technical limitation to this?). Thanks.