Fl4m3Ph03n1x

Fl4m3Ph03n1x

Module is not available

Background

I have an application :myapp and I am trying to add some web functionality to it from zero using Plug. However, even though I have all the files and modules, present, I still can’t launch it because iex can’t find the modules that are outside the lib folder.

Error

When running iex -S mix I get the following error:

** (Mix) Could not start application myapp: exited in: MyApp.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function MyApp.Web.MetricsExporter.setup/0 is undefined (module MyApp.Web.MetricsExporter is not available)
            MyApp.Web.MetricsExporter.setup()
            (myapp) lib/application.ex:19: MyApp.start/2
            (kernel) application_master.erl:277: :application_master.start_it_old/4

Code

To fix the above error, I added the following lines to my mix.exs:

  defp elixirc_paths(:test), do: ["lib", "web", "test/support"]
  defp elixirc_paths(_),     do: ["lib", "web"]

However the error still persists. My folder structure is the following:

config
lib
  |_ application.ex
web
  |_MetricsExporter.ex

Question

Why can’t iex find and compile the MetricsExporter file?

Marked As Solved

NobbZ

NobbZ

The option has to use plural name.

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement