I hit a bit of an unexpected snag while working on an umbrella app. Each of my apps compiles individually just fine, but when I try to run mix deps.compile from the root of the umbrella, I get an error with one of my apps (named “countries”):
== Compilation error in file lib/resource.ex ==
** (CompileError) lib/resource.ex:2: module Ecto.Query is not loaded and could not be found
The file in question has this at its top:
defmodule Countries.Resource do
import Ecto.Query, warn: false
I do have {:ecto, "~> 3.0"} in the country app’s mix file. And if I go into the app, I can compile it fine:
cd apps/countries
mix deps.compile
Can anyone shed some light on why this is problematic?
I have no explanation for this, but now when I run the command, it works. Maybe something was stuck in cache and the “countries” app finally started seeing the ecto dependency.
I was having this exact issue yesterday with a new phoenix umbrella project. I tried everything but in the end deleting the _build directory was what fixed it for me.