1

I have problem with adding dependency (I'm using rebar3 for compiling).

For example I want use jsx (tried also with jimmy and some other) so I added below lines in rebar.config (as it is stated on github for this project):

{deps, [
       ...
       {jsx, "~> 3.0"}
]}

But when compiling and run app I got: ** exception error: undefined function jsx:is_json/1

I also tried adding jsx to myapp.app.src

    {applications, [
        kernel,
        stdlib,
        jsx
    ]},

And I checked different combination described on https://www.rebar3.org/docs/configuration/dependencies/ but still have same error.

When I compiling my app, I don't even get info that some deps are fetching, just only:

rebar3 compile 
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling myapp

Do you now what I have missed for adding other modules?

2
  • Can you try running DIAGNOSTICS=1 DEBUG=1 rebar3 compile and pasting the output around here? Commented Jul 8 at 5:43
  • 1
    Hello. I added output of command as an answer in this thread.
    – user1235
    Commented Jul 8 at 6:33

2 Answers 2

1

I found where is the problem. I've added deps under shell config instead of a separate configuration. It should be like:

{erl_opts, [debug_info]}.
{deps, [jsx]}.

{shell, [
    %% {config, "config/sys.config"},
    {apps, []}
]}.

But I had:

{erl_opts, [debug_info]}.

{shell, [
    %% {config, "config/sys.config"},
    {apps, []},
    {deps, [jsx]}
]}.

Thank you for help. It was a good lesson for me to read more carefully :)

0

Here is an output from requested command DIAGNOSTICS=1 DEBUG=1 rebar3 compile run:

===> Expanded command sequence to be run: [app_discovery,install_deps,lock,compile]
===> Running provider: app_discovery
===> Found top-level apps: [myapp]
    using config: [{src_dirs,["src"]},{lib_dirs,["apps/*","lib/*","."]}]
===> Running provider: install_deps
===> Verifying dependencies...
===> Running provider: lock
===> Running provider: compile
===> Compile (apps)
===> Running hooks for compile with configuration:
===>    {pre_hooks, []}.
===> Compile (project_apps)
===> Running hooks for compile in app myapp (/home/user/erlang/myapp) with configuration:
===>    {pre_hooks, []}.
===> Running hooks for erlc_compile in app myapp (/home/user/erlang/myapp) with configuration:
===>    {pre_hooks, []}.
===> Analyzing applications...
===> Compiling myapp
===> compile options: {erl_opts, [debug_info]}.
===> files to analyze ["/home/user/erlang/myapp/src/myapp.erl"]
===> Running hooks for erlc_compile in app myapp (/home/user/erlang/myapp) with configuration:
===>    {post_hooks, []}.
===> Running hooks for app_compile in app myapp (/home/user/erlang/myapp) with configuration:
===>    {pre_hooks, []}.
===> Running hooks for app_compile in app myapp (/home/user/erlang/myapp) with configuration:
===>    {post_hooks, []}.
===> Running hooks for compile in app myapp (/home/user/erlang/myapp) with configuration:
===>    {post_hooks, []}.
===> Running hooks for compile with configuration:
===>    {post_hooks, []}.

Not the answer you're looking for? Browse other questions tagged or ask your own question.