我使用了库https://github.com/CargoSense/ex_aws,我遇到了这样的问题:
== Compilation error on file web/models/s3.ex ==
** (CompileError) web/models/s3.ex:2: module ExAws.S3.Client is not loaded and could not be found
(elixir) expanding macro: Kernel.use/2
web/models/s3.ex:2: Minion.S3 (module)
(elixir) lib/kernel/parallel_compiler.ex:116: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1
在我的mix.exs中:
def application do
[mod: {Minion, []},
applications: [:phoenix, ... :ex_aws, :httpoison, :poison]]
end
...
defp deps do
[{:phoenix, "~> 1.2.1"},
...
{:ex_aws, "~> 1.0.0-beta0"},
{:poison, "~> 2.0"},
{:httpoison, "~> 0.8"}]
end
我的config.exs:
config :minion, :ex_aws,
access_key_id: "...",
secret_access_key: "...",
region: "us-east-1",
s3: [
scheme: "http://",
host: "...",
region: "us-east-1"
]
我的s3.ex:
defmodule Minion.S3 do
use ExAws.S3.Client, otp_app: :minion
end
对于解决此问题的任何帮助,我将不胜感激
答案 0 :(得分:0)
:ex_aws
不使用您需要在模块Minion.S3
中执行的旧版(1.0.0版)。这就是ExAws.S3.Client
不存在的原因。相反,尝试:
config :minion, :ex_aws,
更改为config :ex_aws,
S3.list_buckets |> ExAws.request #=> {:ok, response}
而不是旧样式Minion.S3.list_buckets