简体   繁体   English

Elixir:无法编译ExActor依赖项

[英]Elixir: Not able to compile the ExActor dependency

I am trying to run a calculator demo from ExActor Demos . 我正在尝试从ExActor Demos运行计算器演示 It requires adding the new ExActor module as a dependency in the mix.exs file as following. 它要求将新的ExActor模块作为依赖项添加到mix.exs文件中,如下所示。

defp deps do
 [
   {:exactor, "~> 2.2.3", warn_missing: false}
 ]
end

I did mix deps.get and mix deps.update --all to download the dependency. 我确实mix deps.getmix deps.update --all来下载依赖项。 However, when the I ran the project using mix run -e CalculatorDemo.exs , it throws the following error. 但是,当我使用mix run -e CalculatorDemo.exs项目时,它将引发以下错误。

mycom@MACHINE:~/calculator$ mix run -e CalculatorDemo.run
Compiling 2 files (.ex)

== Compilation error in file lib/calculator.ex ==
** (CompileError) lib/calculator.ex:2: module ExActor is not loaded and could not be found
(elixir) expanding macro: Kernel.use/1
lib/calculator.ex:2: Calculator (module)

I am new to Elixir and couldn't find any helpful sources to resolve the above. 我是Elixir的新手,找不到解决上述问题的有用资源。 Any comments on what am I doing wrong here? 关于我在这里做错什么的任何评论吗?

There is no ExActor module in the exactor package. 没有ExActor在模块exactor包。 Since version 0.3.0 , you need to use ExActor.GenServer to create a GenServer module. 从0.3.0版本开始 ,您需要use ExActor.GenServer创建GenServer模块。 The example you linked to was last updated 4 years ago which most likely was before v0.3.0. 您链接到的示例的最新更新时间为4年前,最有可能在v0.3.0之前。

So, change: 因此,更改:

use ExActor

to: 至:

use ExActor.GenServer

The same Calculator example is also present in the project's README which works with the latest ExActor; 项目的自述文件中也提供了相同的Calculator示例,该示例与最新的ExActor一起使用。 you might want to run that code instead. 您可能想运行该代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM