Functional programming 虽然包含并编译了jsx,但找不到函数'jsx:is_json/1'

Functional programming 虽然包含并编译了jsx,但找不到函数'jsx:is_json/1',functional-programming,erlang,rebar3,Functional Programming,Erlang,Rebar3,我正在使用Erlang工具链(OTP、rebar3、cowboy、jsx…)编写一个Web应用程序。以下代码不起作用,因为在运行时找不到jsx:is_json/1 handle_login(Req, State) -> {ok, Data, _} = cowboy_req:body(Req), case jsx:is_json(Data) of false -> cowboy_req:reply(400, [ {<<"cont

我正在使用Erlang工具链(OTP、rebar3、cowboy、jsx…)编写一个Web应用程序。以下代码不起作用,因为在运行时找不到
jsx:is_json/1

handle_login(Req, State) ->
  {ok, Data, _} = cowboy_req:body(Req),

  case jsx:is_json(Data) of
    false -> cowboy_req:reply(400,
      [
        {<<"content-type">>, <<"application/json">>}
      ],
      <<"Invalid JSON">>,
      Req);
handle\u登录(请求、状态)->
{ok,Data,{}=cowboy_req:body(req),
案例jsx:json(数据)是
错误->牛仔要求:回复(400,
[
{, }
],
,
要求);
堆栈跟踪:

{[{reason,undef},
   {mfa,{erbid_api_handler,handle,2}},
   {stacktrace,
      [{jsx,is_json,[<<"{\"username\":\"tom\"}">>],[]},
       {erbid_api_handler,handle_login,2,
           [{file,
                "/Users/khanhhua/dev/project-erbid/_build/default/lib/erbid/src/erbid_api_handler.erl"},
            {line,45}]},
       {erbid_api_handler,handle,2,
... truncated for brevity
{[{reason,undf},
{mfa,{erbid_api_handler,handle,2}},
{stacktrace,
[{jsx,is_json,[],[]},
{erbid_api_handler,handle_login,2,
[{文件,
“/Users/khanhua/dev/project erbid/\u build/default/lib/erbid/src/erbid\u api\u handler.erl”,
{line,45}]},
{erbid_api_处理程序,句柄,2,
…为简洁起见被截断
文件夹结构:


我需要知道如何修复此问题。谢谢。

我已找到此问题的原因。我没有在我的
erbid.app.src
的应用程序部分中包含模块
jsx

{application, erbid, [
    {description, "Realtime system"},
    {vsn, "0.1.0"},
    {registered, []},
    {applications, [
        kernel,
        stdlib,
        cowboy,
        jsx
    ]},
    {mod, {erbid, []}},
    {env, []}
]}.

完全是因为我缺乏Erlang的经验。

你在运行什么rebar3命令来启动你的应用程序?@Stratus3D谢谢你的评论。它是
\u build/default/rel/erbid\u alpha/bin/erbid\u alpha前台
。另外,我已经解决了这个愚蠢的问题。