Skip to content
Latchkey

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.

elm
-- 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

  1. Confirm the file path matches the module name (Page/Home.elm for Page.Home).
  2. Add its root to source-directories in elm.json if it is missing.
  3. Re-run elm make to confirm the module resolves.
elm.json
{
  "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.

Terminal
rm -rf "${ELM_HOME:-$HOME/.elm}"
elm make src/Main.elm

How to prevent it

  • Keep module file paths aligned with their dotted module names.
  • Cache ~/.elm (or ELM_HOME) keyed on elm.json so it stays consistent.
  • List every source root in source-directories.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →