ssl.cipher_suites/0 未定义或私有,请改用 cipher_suites/2,3 (ssl 10.4.1) :ssl.cipher_suites()

ssl.cipher_suites/0 is undefined or private, use cipher_suites/2,3 instead (ssl 10.4.1) :ssl.cipher_suites()

** (UndefinedFunctionError) function :ssl.cipher_suites/0 is undefined or private, use cipher_suites/2,3 instead
    (ssl 10.4.1) :ssl.cipher_suites()
    (hackney 1.15.2) /Users/naveen/NAV/moviematch/deps/hackney/src/hackney_ssl.erl:77: :hackney_ssl.ciphers/0
    (hackney 1.15.2) /Users/naveen/NAV/moviematch/deps/hackney/src/hackney_ssl.erl:69: :hackney_ssl.connect/4
    (hackney 1.15.2) /Users/naveen/NAV/moviematch/deps/hackney/src/hackney_connect.erl:277: :hackney_connect.do_connect/5
    (hackney 1.15.2) /Users/naveen/NAV/moviematch/deps/hackney/src/hackney_connect.erl:47: :hackney_connect.connect/5
    (hackney 1.15.2) /Users/naveen/NAV/moviematch/deps/hackney/src/hackney.erl:333: :hackney.request/5
    (httpoison 1.8.0) lib/httpoison/base.ex:846: HTTPoison.Base.request/6

此处指定的项目依赖项: https://github.com/navyad/moviematch/blob/master/mix.exs#L22

当前 Elixir 版本:1.12 和 Erlang/OTP 24 我已经将 httppoison 从 1.4 升级到 1.8

步骤

我不知道你为什么要从 GitHub 而不是 Hex 查看 Hackney,但我可以通过使用 mix deps update --all:

升级你的依赖项来解决你的问题
$ mix deps.update --all
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  floki 0.20.4
  html_entities 0.4.0
  metrics 1.0.1
  mimerl 1.2.0
  poison 3.1.0
Upgraded:
  certifi 2.5.1 => 2.6.1
  httpoison 1.5.0 => 1.8.0
  idna 6.0.0 => 6.1.1
  mochiweb 2.18.0 => 2.20.1
  parse_trans 3.3.0 => 3.3.1
  ssl_verify_fun 1.1.5 => 1.1.6
  unicode_util_compat 0.4.1 => 0.7.0 (minor)
New:
* Updating httpoison (Hex package)
* Updating hackney (Hex package)
* Updating certifi (Hex package)
* Updating idna (Hex package)
* Updating parse_trans (Hex package)
* Updating ssl_verify_fun (Hex package)
* Updating unicode_util_compat (Hex package)
* Updating mochiweb (Hex package)

测试:

Generated moviematch app
Interactive Elixir (1.12.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> MovieMatch.Imdb.fetch_imdb_watchlist("ur26610840")

18:39:25.419 [info]  parsing html...

18:39:25.457 [info]  building json...
%{id: "tt11296058", title: "Kunstneren og tyven"}
%{id: "tt11655202", title: "Retfærdighedens ryttere"}
%{id: "tt8185182", title: "Diqiu zuihou de yewan"}
%{id: "tt8637428", title: "The Farewell"}
%{id: "tt8649190", title: "Here Before"}
%{id: "tt9601220", title: "Black Bear"}
%{id: "tt9639470", title: "Last Night in Soho"}

18:39:25.459 [info]  no. of imdb movies: 7
%{
  "tt11296058" => "Kunstneren og tyven",
  "tt11655202" => "Retfærdighedens ryttere",
  "tt8185182" => "Diqiu zuihou de yewan",
  "tt8637428" => "The Farewell",
  "tt8649190" => "Here Before",
  "tt9601220" => "Black Bear",
  "tt9639470" => "Last Night in Soho"
}

运行 在 OTP 24.0.2 和 Elixir 1.12.1 上。

如果您看到这个错误(或类似的错误),您的本地 Erlang 可能不包含 :ssl 包。一个示例 GitHub 问题:

安装 :ssl 软件包取决于您系统的 OS。