Getting error Could not compile dependency :mimerl

(Mix) Could not compile dependency :mimerl, "/home/ubuntu/.mix/rebar3
bare compile --paths "/var/www/qserv/elixirbackend/_build/dev/lib/*/ebin"" 
command failed. You can recompile this dependency with "mix deps.compile mimerl", 
update it with "mix deps.update mimerl" or clean it with "mix deps.clean mimerl"

I am getting this error on my server. Everything was working perfectly fine but after restarting my server, started facing the above mentioned issue.

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

Elixir 1.6.3 (compiled with OTP 19)

This is not the full compilation error. Is there more detailed log in your console, or maybe it points you to a file where it saved compilation error?

ubuntu@…secret…:/var/www/qserv/elixir-backend$ mix deploy
Resolving Hex dependencies…
Dependency resolution completed:
bamboo 0.8.0
bamboo_smtp 1.4.0
base64url 0.0.1
bcrypt_elixir 0.12.1
blacksmith 0.2.1
bunt 0.2.0
certifi 2.0.0
combine 0.10.0
comeonin 4.1.0
connection 1.0.4
cors_plug 1.5.0
cowboy 1.1.2
cowlib 1.0.2
credo 0.8.10
crontab 1.1.2
csv 2.0.0
db_connection 1.1.3
decimal 1.4.1
ecto 2.2.8
ecto_rut 1.2.2
elixir_make 0.4.1
ex_json_schema 0.5.6
ex_utils 0.1.7
exq 0.9.1
exq_ui 0.9.0
faker 0.9.0
gen_smtp 0.12.0
gen_stage 0.13.1
geo 2.1.0
geo_postgis 1.1.0
gettext 0.13.1
guardian 0.14.5
guardian_db 0.8.0
hackney 1.11.0
hpack_erl 0.2.3
httpoison 0.13.0
idna 5.1.0
jose 1.8.4
kadabra 0.3.8
metrics 1.0.1
mime 1.2.0
mimerl 1.0.2
parallel_stream 1.0.6
phoenix 1.3.0
phoenix_ecto 3.3.0
phoenix_pubsub 1.0.2
pigeon 1.1.6
plug 1.4.5
poison 3.1.0
poolboy 1.5.1
postgrex 0.13.5
quantum 2.2.4 RETIRED!
(invalid) Problem with Daylight Saving Time
ranch 1.3.2
redix 0.7.0
sentry 6.1.0
ssl_verify_fun 1.1.1
sweet_xml 0.6.5
timex 3.2.1
tzdata 0.5.16
unicode_util_compat 0.3.1
uuid 1.1.8
All dependencies up to date
==> base64url (compile)
escript: exception error: no match of right hand side value undefined
in function rebar_log:log/3 (/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_log.erl, line 94)
in call from rebar3:handle_error/1 (/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar3.erl, line 314)
in call from escript:run/2 (escript.erl, line 759)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3
** (Mix) Could not compile dependency :mimerl, “/home/ubuntu/.mix/rebar3 bare compile --paths “/var/www/qserv/elixir-backend/_build/dev/lib/*/ebin”” command failed. You can recompile this dependency with “mix deps.compile mimerl”, update it with “mix deps.update mimerl” or clean it with “mix deps.clean mimerl”

The log mentions the command that failed: /home/ubuntu/.mix/rebar3 bare compile --paths "/var/www/qserv/elixir-backend/_build/dev/lib/*/ebin"

What’s the output if you run that?

~$ /home/ubuntu/.mix/rebar3 bare compile --paths “/var/www/qserv/elixir-backend/_build/dev/lib/*/ebin”
escript: exception error: no match of right hand side value undefined
in function rebar_log:log/3 (/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_log.erl, line 94)
in call from rebar3:handle_error/1 (/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar3.erl, line 314)
in call from escript:run/2 (escript.erl, line 759)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3

could you paste your mix.exs file here? i think this error comes due to rebar configuration not found

So if you google the error “Getting error Could not compile dependency :mimerl” it shows a few responses where the compilation of that thing failed because of network issue. Either a misconfigured proxy or some other problem with downloading stuff.

I honestly am puzzled as the above do not give much information on what precisely fails during compilation.

The Makefile for this library downloads the mime database from external URL, which might fail, it also requires you have wget tool in the system.

Can you check that:

  1. wget - is a command that is found. If not, install this Linux tool.
  2. You can fetch with wget the following file: http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

Basically this should work:

wget "http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types"

The relevant part Makefile for reference is located here: https://github.com/benoitc/mimerl/blob/master/Makefile#L11

1 Like

The error with its stacktrace might get written to rebar.crashdump or something like this.

One also could run REBAR_DEBUG=1 mix deps.compile, this way rebar will spit out a lot more information.

I have already done that and tried almost all of the options in few github urls and stackoverflow e.g (Mix) Could not compile dependency idna, /root/.mix/rebar command failed. If you want to recompile this dependency, please run: mix deps.compile idna · Issue #3857 · elixir-lang/elixir · GitHub and Failed to write package index && Uncaught error in rebar_core on Ubuntu 16.04 · Issue #1296 · erlang/rebar3 · GitHub

and here is the output

REBAR_DEBUG=1 mix deps.compile
==> base64url (compile)
Could not find "rebar3", which is needed to build dependency :mimerl
I can install a local copy which is just used by Mix
Shall I install rebar3? (if running non-interactively, use "mix local.rebar --force") [Yn] 
/home/ubuntu/.mix/rebar already exists, overwrite? [Yn] 
* creating /home/ubuntu/.mix/rebar
/home/ubuntu/.mix/rebar3 already exists, overwrite? [Yn] 

** (File.Error) could not write to file “/home/ubuntu/.mix/rebar3”: illegal operation on a directory
(elixir) lib/file.ex:934: File.write!/3
(mix) lib/mix/tasks/local.rebar.ex:74: Mix.Tasks.Local.Rebar.install_from_path/3
(mix) lib/mix/tasks/deps.compile.ex:226: Mix.Tasks.Deps.Compile.handle_rebar_not_found/1
(mix) lib/mix/tasks/deps.compile.ex:188: Mix.Tasks.Deps.Compile.do_rebar3/2
(mix) lib/mix/tasks/deps.compile.ex:85: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2
(elixir) lib/enum.ex:1294: Enum.“-map/2-lists^map/1-0-”/2
(elixir) lib/enum.ex:1294: Enum.“-map/2-lists^map/1-0-”/2
(mix) lib/mix/tasks/deps.compile.ex:65: Mix.Tasks.Deps.Compile.compile/2

Note: rebar3 was installed earlier but I deleted and tried to install fresh and now I am even unable to install rebar3. Same error happens

When you do ls -lh ${HOME}/.mix | grep rebar what is the output you get?

From what I have seen in the last two posts, I guess you have some rebar3 binary there that you do not own/have not the proper rights to execute and or overwrite it.

-rwxr-xr-x  1 ubuntu ubuntu 200K Apr  3 15:42 rebar
drwxr-xr-x 10 root   root   4.0K Apr  3 11:03 rebar3

You must have run sudo mix a few times. That’s why the directory has root access. There is generally no need to run mix with sudo.

2 Likes

Gotcha… Not only its owned by root, its a directory as well… Before running the following commands, make sure that you do not have any important data left in that folder!

sudo rm -rf /home/ubuntu/.mix/rebar3
mix local.rebar --force

Ready to go…

2 Likes

Thanks @NobbZ, I have tried the above recommended commands but still its giving the following error

ubuntu@ip-172-31-27-178:/var/www/qserv/elixir-backend$ sudo rm -rf /home/ubuntu/.mix/rebar3
ubuntu@ip-172-31-27-178:/var/www/qserv/elixir-backend$ mix local.rebar --force
  • creating /home/ubuntu/.mix/rebar
  • creating /home/ubuntu/.mix/rebar3
    ubuntu@ip-172-31-27-178:/var/www/qserv/elixir-backend$ iex -S mix phx.server
    Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:10] [hipe] [kernel-poll:false]

escript: exception error: no match of right hand side value undefined
in function rebar_log:log/3 (/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_log.erl, line 94)
in call from rebar3:handle_error/1 (/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar3.erl, line 314)
in call from escript:run/2 (escript.erl, line 759)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3
** (Mix) Could not compile dependency :mimerl, “/home/ubuntu/.mix/rebar3 bare compile --paths “/var/www/qserv/elixir-backend/_build/dev/lib/*/ebin”” command failed. You can recompile this dependency with “mix deps.compile mimerl”, update it with “mix deps.update mimerl” or clean it with “mix deps.clean mimerl”

But now we know that rebar and rebar3 are installed correctly, now we can start debugging your issue with :mimerl.

Now since you have a working rebar(3), have you tried running mix again with REBAR_DEBUG=1?

1 Like

Can you try running REBAR_DEBUG=1 mix deps.compile mimerl?
Or DEBUG=1 mix deps.compile mimerl?

I think you are running just iex -S mix phx.server which wouldn’t know to output additional information about the problem.

Thank you so much @NobbZ @idi527, Server is up and running now