Missing Module deploying modules locally

I am trying the Blabber example. GitHub - conradwt/blabber-using-elixir: The purpose of this repository is to provide a very simple example of hot code loading and communicating between Erlang processes using the Elixir Language.

When I run

nl(Blabber)

it gives me an error message like described in documentation

Returns {:error, :nofile} if the object code (i.e. “.beam” file) for the module could not be found locally.

My question is: How should I run the nl function to find my beam file?
It is defenitely compiled but I think I should enter the absolute path to .beam file…

Maybe nl(:"lib/Blabber")

I don’t know.

You are running iex -S mix yes?

yes I am running iex -S mix

Hmm, in that case, from the commandline, what is the full results of rm -r _build; mix compile?

Compiling 1 file (.ex)
Generated blabber app

this is full result

Oh wow, no dependencies really? Huh, I guess it doesn’t.

Well let me try it:

╰─➤  git clone https://github.com/conradwt/blabber-using-elixir.git
Cloning into 'blabber-using-elixir'...
remote: Counting objects: 39, done.
remote: Total 39 (delta 0), reused 0 (delta 0), pack-reused 39
Unpacking objects: 100% (39/39), done.
╰─➤  cd blabber-using-elixir 
╰─➤  mix compile
Compiling 1 file (.ex)
Generated blabber app
╰─➤  iex -S mix
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.6.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> nl(Blabber)
{:ok, []}
iex(2)>

Seems to work, do you not get the same results? This is why it is generally good to show the entire commandline session that you are testing with. :slight_smile:

Hmm. I didn’t clone repo. I just typed in my editor the Blabber module. And then compiled it. I will try now with cloning and see how different it is.

~/dev/elixir/FromGitDeployblabber
git clone https://github.com/conradwt/blabber-using-elixir.git
Klone nach 'blabber-using-elixir' ...
remote: Counting objects: 39, done.
remote: Total 39 (delta 0), reused 0 (delta 0), pack-reused 39
Entpacke Objekte: 100% (39/39), Fertig.
Prüfe Konnektivität ... Fertig.

~/dev/elixir/FromGitDeployblabber
cd blabber-using-elixir/
~/dev/elixir/FromGitDeployblabber/blabber-using-elixir(master)
mix compile
Compiling 1 file (.ex)
Generated blabber app

~/dev/elixir/FromGitDeployblabber/blabber-using-elixir(master)
iex -S mix
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [kernel-poll:false]

Interactive Elixir (1.6.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> nl(Blabber)
{:ok, []}
iex(2)> 

That is my output

1 Like

Uh, did you have no code to run then? How’d you get it?

Yep, that’s working then. :slight_smile:

Thank you. It works. indeed. I should now look what was different on my setup and setup from git repo.

I’m quite curious. ^.^

The problem is. When you try to follow the tutorial in README.md step by step it does not work. Something is missing. There.

Step 18

Produce:

iex(dog@t420)4> :c.nl(Blabber)
:error

Can you do a full asciinema session of it showing everything you did?

Oh also, you don’t need :c.nl, just nl, that repository is years old. ^.^;
I’m not even sure :c.nl would work actually…

Dog Terminal https://asciinema.org/a/rt8Fhlp2N6zXNLlzZzLeDnZDF
Bird Terminal https://asciinema.org/a/0mxfE2A0yUQul1pAduEkFiPRb

Your problem I’d bet is here (and similar on the bird one):

alfa@t420:~/dev/elixir/FromGitDeployblabber/blabber-using-elixir(master)$ iex --sname dog 

It should instead be iex --sname dog -S mix. The -S mix will set up the environment so it knows the compilation directories and more. :slight_smile:

1 Like

Yes! Thank You man. It works now. And instead of running c("lib/blabber.ex") just do>iex recompile and then nl(Blabber) and it deploys to bird and cat. :slight_smile:

1 Like