I am new to Elixir and Phoenix so this problem is probably fairly trivial. My Phoenix application is an API client and I am trying to create a struct to model the data I will receive from the REST endpoint. I basically followed the small example on the Poison GitHub page to create my module:
defmodule ElixirServer.CurrentlyReprModule do
@derive [Poison.Encoder]
defstruct [:id, :time, :summary, :icon, :nearestStormDistance,
:nearestStormBearing, :precipIntensity, :precipProbability, :temperature,
:apparentTemperature, :dewPoint, :humidity, :pressure, :windSpeed, :windGust,
:windBearing, :cloudCover, :uvIndex, :visibility, :ozone]
end
The module is located under lib/elixir_server/
(is this even the best location for this type of file?).
My problem is when I try to compile the file I get this error:
(CompileError) lib/elixir_server/currently_repr_module.ex:2: module Poison.Encoder is not loaded and could not be found
When I try to run iex -S mix
I get a similar error:
(UndefinedFunctionError) function Poison.Encoder.__using__/1 is undefined or private
Poison is included in the dependencies in mix.exs. How do I resolve this error?