Umbrella project: failed to load Jason for Phoenix JSON encoding

I’m reading the final release of Phoenix in Action, and I’m having the same problem as this issue on github, namely when I run

/auction_umbrella/apps/auction_web$ iex -S mix phx.server

I get the error:

Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]

warning: failed to load Jason for Phoenix JSON encoding
(module Jason is not available).

Ensure Jason exists in your deps in mix.exs,
and you have configured Phoenix to use it for JSON encoding by
verifying the following exists in your config/config.exs:

    config :phoenix, :json_library, Jason


  (phoenix) lib/phoenix.ex:40: Phoenix.start/2
  (kernel) application_master.erl:273: :application_master.start_it_old/4

Compiling 11 files (.ex)

== Compilation error in file lib/auction_web/endpoint.ex ==
** (ArgumentError) invalid :json_decoder option. The module Poison is not loaded and could not be found
    (plug) lib/plug/parsers/json.ex:54: Plug.Parsers.JSON.validate_decoder!/1
    (plug) lib/plug/parsers/json.ex:32: Plug.Parsers.JSON.init/1
    (plug) lib/plug/parsers.ex:245: anonymous fn/3 in Plug.Parsers.convert_parsers/2
    (elixir) lib/enum.ex:1899: Enum."-reduce/3-lists^foldl/2-0-"/3
    (plug) lib/plug/parsers.ex:228: Plug.Parsers.convert_parsers/2
    (plug) lib/plug/parsers.ex:224: Plug.Parsers.init/1
    (plug) lib/plug/builder.ex:302: Plug.Builder.init_module_plug/4
    (plug) lib/plug/builder.ex:286: anonymous fn/5 in Plug.Builder.compile/3

Other info:

$ mix phx.new --version
Phoenix v1.4.0

I put the Jason dependency in both the umbrella app’s dependencies and the Phoenix apps dependencies, and ran mix deps.get in both app directories, and I still get the error.

Welcome to the forums!

As this is being run then what is the contents of the inside of the files /auction_umbrella/apps/auction_web/config/config.exs, /auction_umbrella/apps/auction_web/config/dev.exs, as well as /auction_umbrella/apps/auction_web/mix.exs? :slight_smile:

1 Like

Thanks for taking a look OvermindDL1. I would have deleted my post just after I wrote it, but it got submitted for moderation. It turns out I spelled phoneix wrong in the config file. Sorry for wasting your time.

2 Likes

Happens to us all. ^.^

1 Like