简体   繁体   中英

Elixir: Not able to compile the ExActor dependency

I am trying to run a calculator demo from ExActor Demos . It requires adding the new ExActor module as a dependency in the mix.exs file as following.

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. However, when the I ran the project using mix run -e CalculatorDemo.exs , it throws the following error.

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. Any comments on what am I doing wrong here?

There is no ExActor module in the exactor package. Since version 0.3.0 , you need to use ExActor.GenServer to create a GenServer module. The example you linked to was last updated 4 years ago which most likely was before 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; you might want to run that code instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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