首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当使用exrm时,production没有找到OTP模块:httpc。

当使用exrm时,production没有找到OTP模块:httpc。
EN

Stack Overflow用户
提问于 2016-05-19 14:15:20
回答 1查看 723关注 0票数 5

我正试图为我的凤凰框架项目创建一个版本。

一切正常,直到我的代码需要使用OTP中的httpc模块执行特定的操作。

显然exrm没有捆绑httpc模块,因此找不到它。

我试图将它添加到我的mix.exs应用程序依赖项中,但是一旦我这样做了,它就会因为“错误”而拒绝创建一个发行版。

有人知道怎么解决这个问题吗?

对于具有:httpc作为依赖项的mix.env:

代码语言:javascript
复制
$ MIX_ENV=prod mix release --verbosity=vebose                                                        
        Building release with MIX_ENV=prod.
        ==> Generating relx configuration...
        ==> Generating sys.config...
        ==> Generating boot script...
        ==> Packaging consolidated protocols...
        ==> Generating release...
        ===> Starting relx build process ...
        ===> Resolving OTP Applications from directories:
                  /home/morgan/Documents/rateapi/_build/prod/lib
                  /home/morgan/Documents/rateapi/deps
                  /usr/local/lib/elixir/bin/../lib/eex/ebin
                  /usr/local/lib/elixir/bin/../lib/elixir/ebin
                  /usr/local/lib/elixir/bin/../lib/ex_unit/ebin
                  /usr/local/lib/elixir/bin/../lib/iex/ebin
                  /usr/local/lib/elixir/bin/../lib/logger/ebin
                  /usr/local/lib/elixir/bin/../lib/mix/ebin
                  /home/morgan/Documents/rateapi/lib
                  /usr/erlang/otp_R18B03/lib/erlang/lib
                  /home/morgan/Documents/rateapi/rel
        ==> ERROR: "Failed to build release. Please fix any errors and try again."

对于没有:httpc依赖项的mix.env:

代码语言:javascript
复制
** (exit) an exception was raised:
    ** (UndefinedFunctionError) function :httpc.request/4 is undefined (module :httpc is not available)
        :httpc.request(:get, {'http://free.currencyconverterapi.com/api/v3/currencies', []}, [], [])
        (fx_rates) web/controllers/rate_controller.ex:46: FxRates.V1.RateController.reload_currencies/0
        (fx_rates) web/controllers/rate_controller.ex:66: FxRates.V1.RateController.show/2
        (fx_rates) web/controllers/rate_controller.ex:1: FxRates.V1.RateController.action/2
        (fx_rates) web/controllers/rate_controller.ex:1: FxRates.V1.RateController.phoenix_controller_pipeline/2
        (fx_rates) lib/phoenix/router.ex:261: FxRates.Router.dispatch/2
        (fx_rates) web/router.ex:1: FxRates.Router.do_call/2
        (fx_rates) lib/fx_rates/endpoint.ex:1: FxRates.Endpoint.phoenix_pipeline/1
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-19 14:30:03

你可能错过了erlang的包裹。尝试安装它或重新安装它。如果您正在使用Ubuntu,您可以通过以下方式安装它:

代码语言:javascript
复制
sudo apt-get install erlang-inets

或者,您可以尝试将模块:inets添加到mix.exs应用程序依赖项中。

票数 11
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37325956

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档