Failing to build w/ httpoison

Simply wanting to try an HTTP get with HTTPoison.

mix.exs

defmodule HttpoisonTest.Mixfile do
  use Mix.Project

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

  # Configuration for the OTP application
  #
  # Type "mix help compile.app" for more information
  def application do
    # Specify extra applications you'll use from Erlang/Elixir
    [extra_applications: [:logger]]
  end

  # Dependencies can be Hex packages:
  #
  #   {:my_dep, "~> 0.3.0"}
  #
  # Or git/path repositories:
  #
  #   {:my_dep, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
  #
  # Type "mix help deps" for more examples and options
  defp deps do
    [
      {:httpoison, "~> 0.11.0"}
    ]
  end
end

Getting deps

% mix deps.get
Running dependency resolution...
Dependency resolution completed:
  certifi 0.7.0
  hackney 1.6.5
  httpoison 0.11.0
  idna 1.2.0
  metrics 1.0.1
  mimerl 1.0.2
  ssl_verify_fun 1.1.1
* Getting httpoison (Hex package)
  Checking package (https://repo.hex.pm/tarballs/httpoison-0.11.0.tar)
  Fetched package
* Getting hackney (Hex package)
  Checking package (https://repo.hex.pm/tarballs/hackney-1.6.5.tar)
  Fetched package
* Getting certifi (Hex package)
  Checking package (https://repo.hex.pm/tarballs/certifi-0.7.0.tar)
  Fetched package
* Getting idna (Hex package)
  Checking package (https://repo.hex.pm/tarballs/idna-1.2.0.tar)
  Fetched package
* Getting metrics (Hex package)
  Checking package (https://repo.hex.pm/tarballs/metrics-1.0.1.tar)
  Fetched package
* Getting mimerl (Hex package)
  Checking package (https://repo.hex.pm/tarballs/mimerl-1.0.2.tar)
  Fetched package
* Getting ssl_verify_fun (Hex package)
  Checking package (https://repo.hex.pm/tarballs/ssl_verify_fun-1.1.1.tar)
  Fetched package

Attempting to drop into iex w/ mix

iex -S mix
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

===> Compiling idna
===> Compiling mimerl
===> Compiling metrics
==> ssl_verify_fun (compile)
Compiled src/ssl_verify_util.erl
Compiled src/ssl_verify_fingerprint.erl
Compiled src/ssl_verify_pk.erl
Compiled src/ssl_verify_hostname.erl
===> Compiling certifi
===> Package certifi-0.7.0 not found. Fetching registry updates and trying again...
===> Updating package registry...
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
** (Mix) Could not compile dependency :hackney, "/Users/???/.mix/rebar3 bare compile --paths "/Users/???/code/elixir/httpoison_test/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile hackney", update it with "mix deps.update hackney" or clean it with "mix deps.clean hackney"
1 Like

elixir -v
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.4.1

1 Like

here is a bit more detail when i use DEBUG=1

% (export DEBUG=1 ; iex -S mix)
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

===> Expanded command sequence to be run: []
===> Expanded command sequence to be run: [{default,app_discovery},
                                           {bare,compile}]
===> Error loading package registry: {read_error,
                                      {not_a_log_file,
                                       "/Users/qcrain/.cache/rebar3/hex/default/registry"}}
===> Package certifi-0.7.0 not found. Fetching registry updates and trying again...
===> Updating package registry...
===> Fetching registry from "https://repo.hex.pm:443/registry.ets.gz?"
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: {badmatch,
                         {error,{rebar_prv_update,package_index_download}}}
===> Stack trace to the error location:
[{rebar_packages,handle_missing_package,3,
                 [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_packages.erl"},
                  {line,85}]},
 {rebar_app_utils,update_source,3,
                  [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_app_utils.erl"},
                   {line,198}]},
 {rebar_app_utils,dep_to_app,7,
                  [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_app_utils.erl"},
                   {line,169}]},
 {rebar_app_utils,'-parse_deps/6-lc$^0/1-0-',6,
                  [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_app_utils.erl"},
                   {line,98}]},
 {rebar_app_discover,'-do/2-fun-0-',3,
                     [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_app_discover.erl"},
                      {line,31}]},
 {lists,foldl,3,[{file,"lists.erl"},{line,1263}]},
 {rebar_app_discover,do,2,
                     [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_app_discover.erl"},
                      {line,27}]},
 {rebar_prv_app_discovery,do,1,
                          [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_app_discovery.erl"},
                           {line,38}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
** (Mix) Could not compile dependency :hackney, "/Users/???/.mix/rebar3 bare compile --paths "/Users/???/code/elixir/httpoison_test/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile hackney", update it with "mix deps.update hackney" or clean it with "mix deps.clean hackney"

having ‘tristan’ in the path seems pretty bad?!? (as that isn’t me! wink!)

1 Like

I had a similar rebar_core error. It was solved by this post.

2 Likes

yeah, that did it; “that” in this case being to delete the ‘_build’ directory.

all the other things i did (like messing around with ~/.cache/…/hex/default/registry etc) didn’t help/work.

not sure how i could have figured that out, so thanks!!

1 Like

Glad to hear - thank Chris McCord!

1 Like