Elm "I cannot find module" / corrupt cache in CI
elm walked your source directories and the package cache and could not locate a module it needs. The file may be outside the configured source-directories, or the cached package data is missing or corrupt.
What this error means
elm make fails with "-- MODULE NOT FOUND" / "I cannot find the X module" or "I cannot find module" pointing at a file path that is not under any listed source directory.
-- MODULE NOT FOUND ---------------------------------------- src/Main.elm
You are trying to import a `Page.Home` module:
import Page.Home
I cannot find that module! Is there a typo in the module name?Common causes
The module is outside source-directories
elm.json lists source-directories, and a file under another folder is invisible to the compiler regardless of its module name.
A stale or partial package cache
A truncated ELM_HOME cache from a cancelled download leaves elm unable to find a dependency module.
How to fix it
Add the directory or fix the module path
- Confirm the file path matches the module name (
Page/Home.elmforPage.Home). - Add its root to
source-directoriesin elm.json if it is missing. - Re-run
elm maketo confirm the module resolves.
{
"source-directories": [ "src" ]
}Clear the elm cache for a corrupt entry
A bad package cache from an interrupted CI download must be removed so elm refetches it cleanly.
rm -rf "${ELM_HOME:-$HOME/.elm}"
elm make src/Main.elmHow to prevent it
- Keep module file paths aligned with their dotted module names.
- Cache
~/.elm(orELM_HOME) keyed on elm.json so it stays consistent. - List every source root in
source-directories.