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'

Where Next?

Popular in Questions Top

_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31194 112
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54250 245
New

We're in Beta

About us Mission Statement