0
我創建了一個項目:如何導入HTTPotion成靈藥項目
$ mix new sample
我編輯的mix.exs
文件:
defmodule Sample.Mixfile do
use Mix.Project
def project do
[app: :sample,
version: "0.1.0",
elixir: "~> 1.3",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps()]
end
def application do
[applications: [:logger, :httpotion]]
end
defp deps do
[{:httpotion, "~> 3.0.2"}]
end
end
和我samplex.ex
文件:
defmodule Sample do
IO.puts "Hello World"
end
我運行:
$ mix deps.get
$ mix
,我也得到:
Compiling 1 file (.ex)
Hello World
Generated sample app
直到這裏都完美的,但是如果我改變sample.ex到:
defmodule Sample do
HTTPotion.get "httpbin.org/get"
end
我得到以下錯誤:
$ mix deps.get
Running dependency resolution
All dependencies up to date
$ mix
Compiling 1 file (.ex)
warning: variable response is unused
lib/sample.ex:2
== Compilation error on file lib/sample.ex ==
** (ArgumentError) argument error
(stdlib) :ets.lookup(:ibrowse_lb, {'httpbin.org', 80})
/Users/xxx/sample/deps/ibrowse/src/ibrowse.erl:328: :ibrowse.send_req/6
lib/httpotion.ex:355: HTTPotion.request/3
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
什麼不見了?我沒有靈丹妙藥的經驗。
嘗試在'mix.exs'中的'applications'中添加':httpotion':'[applications:[:logger,:httpotion]]''。 – Dogbert
謝謝@Dogbert我更新了這個問題,但錯誤是一樣的 – ademar111190