Compile error: module Httpoison is not available

I’m trying to get a simple app working with Httpoison. I added the dependency to my mix.exs, ran “mix deps.get”, ran “mix deps.compile”, and then compiled the app. I get the error message:

warning: function Httpoison.get/2 is undefined (module Httpoison is not available)

I recreated the project from scratch, but that didn’t help. Any ideas why this might be happening?

Here’s the transcript:

% cat mix.exs
defmodule Issues.MixProject do
  use Mix.Project

  def project do
    [
      app: :issues,
      version: "0.1.0",
      elixir: "~> 1.7",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:httpoison, "~> 1.4.0"}
    ]
  end
end

% mix deps.clean --all

% mix deps.get
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  certifi 2.4.2
  hackney 1.14.3
  httpoison 1.4.0
  idna 6.0.0
  metrics 1.0.1
  mimerl 1.0.2
  parse_trans 3.3.0
  ssl_verify_fun 1.1.4
  unicode_util_compat 0.4.1
* Getting httpoison (Hex package)
* Getting hackney (Hex package)
* Getting certifi (Hex package)
* Getting idna (Hex package)
* Getting metrics (Hex package)
* Getting mimerl (Hex package)
* Getting ssl_verify_fun (Hex package)
* Getting unicode_util_compat (Hex package)
* Getting parse_trans (Hex package)

% mix deps.compile
===> Compiling parse_trans
===> Compiling mimerl
===> Compiling metrics
===> Compiling unicode_util_compat
===> Compiling idna
==> ssl_verify_fun
Compiling 7 files (.erl)
Generated ssl_verify_fun app
===> Compiling certifi
===> Compiling hackney
==> httpoison
Compiling 3 files (.ex)
Generated httpoison app

% mix deps
* parse_trans 3.3.0 (Hex package) (rebar3)
  locked at 3.3.0 (parse_trans) 09765507
  ok
* mimerl 1.0.2 (Hex package) (rebar3)
  locked at 1.0.2 (mimerl) 993f9b0e
  ok
* metrics 1.0.1 (Hex package) (rebar3)
  locked at 1.0.1 (metrics) 25f094de
  ok
* unicode_util_compat 0.4.1 (Hex package) (rebar3)
  locked at 0.4.1 (unicode_util_compat) d869e4c6
  ok
* idna 6.0.0 (Hex package) (rebar3)
  locked at 6.0.0 (idna) 689c46cb
  ok
* ssl_verify_fun 1.1.4 (Hex package) (mix)
  locked at 1.1.4 (ssl_verify_fun) f0eafff8
  ok
* certifi 2.4.2 (Hex package) (rebar3)
  locked at 2.4.2 (certifi) 75424ff0
  ok
* hackney 1.14.3 (Hex package) (rebar3)
  locked at 1.14.3 (hackney) b5f6f5dc
  ok
* httpoison 1.4.0 (Hex package) (mix)
  locked at 1.4.0 (httpoison) e0b3c2ad
  ok

% mix compile
Compiling 3 files (.ex)
warning: function Httpoison.get/2 is undefined (module Httpoison is not available)
  lib/github_issues.ex:6

Generated issues app

Fortunately this is pretty easy to fix, the module is HTTPoison not Httpoison.

2 Likes

Thanks, that did it!