DougReeder

DougReeder

Could not compile dependency :canary & module Canada.Can is not loaded and could not be found

On a project we inherited, where the original devs are not available, our mix.exs files contains:


  defp deps do
    [
# ...
      {:canary, "~> 1.1.1"},

… but Canada is not listed there.

mix.lock contains:

  "canada": {:hex, :canada, "1.0.2", "040e4c47609b0a67d5773ac1fbe5e99f840cef173d69b739beda7c98453e0770", [:mix], [], "hexpm", "4269f74153fe89583fe50bd4d5de57bfe01f31258a6b676d296f3681f1483c68"},
  "canary": {:hex, :canary, "1.1.1", "4138d5e05db8497c477e4af73902eb9ae06e49dceaa13c2dd9f0b55525ded48b", [:mix], [{:canada, "~> 1.0.1", [hex: :canada, repo: "hexpm", optional: false]}, {:ecto, ">= 1.1.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f348d9848693c830a65b707bba9e4dfdd6434e8c356a8d4477e4535afb0d653b"},

Running mix test in CI (under Ubuntu 22 and 24) runs fine:

      - run: mix local.hex --force
      - run: mix local.rebar --force
      - run: mix deps.get
      - run: mix compile   # after fixing warnings, add --warnings-as-errors
      - run: mix test

However, when I run those step on my Mac (Intel, Sequoia 15.6.1), I get these messages at the compile step:

    error: module Canada.Can is not loaded and could not be found
    │
  2 │   import Canada.Can, only: [can?: 3]
    │   ^
    │
    └─ lib/canary/plugs.ex:2:3: Canary.Plugs (module)


== Compilation error in file lib/canary/plugs.ex ==
** (CompileError) lib/canary/plugs.ex: cannot compile module Canary.Plugs (errors have been logged)

could not compile dependency :canary, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile canary --force", update it with "mix deps.update canary" or clean it with "mix deps.clean canary"

I have not found a sequence of “mix deps.compile canary --force”, mix deps.update canary" and/or “mix deps.clean canary” which resolves this.

How should I attempt to resolve this?

Marked As Solved

NobbZ

NobbZ

So Mac vs Linux is about the only difference? Or the version of OTP used to build the elixir? As 1.16 supports OTP-24, it might actually built using that.

Try 1.16.0-otp-24 locally, while sticking to OTP 25 otherwise.

Also Liked

NobbZ

NobbZ

What elixir versions are used with which OTP versions?

I have the suspicion that there are subtle changes in protocol handling between the versions CI uses and the elixir version you use locally.

DougReeder

DougReeder

On my machine:

elixir 1.16.0-otp-25
erlang 25.3

In CI:

elixir-version: '1.16'
otp-version: '25.3'

Last Post!

DougReeder

DougReeder

A better solution was found; now .tool-versions is

elixir 1.16-otp-25
erlang 25.3.2.20

It hadn’t been clear that erlang 25.3 didn’t mean “the latest bugfix version of 25.3"

Where Next?

Popular in Questions Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement