Ex_doc: UndefinedFunctionError when generating docs - ExDoc.Config.default/1

Created on 19 Jul 2019  路  4Comments  路  Source: elixir-lang/ex_doc

Hello, thank you so much for all of your hard work on this project.

I was going to publish a package to Hex, and got an error that, through a little Googling, I found meant that I just needed to update my version of ex_doc - I ran mix deps.update ex_doc, which bumped me from 0.18.1 to the latest 0.21.0. However, when I ran mix doc on the project, I got the following UndefinedFunctionError, relating to ExDoc.Config.default/1 being undefined or private:

==> ex_doc
Compiling 19 files (.ex)
warning: redefining module Mix.Tasks.Docs (current version loaded from /Users/username/Documents/my_app/_build/dev/lib/ex_doc/ebin/Elixir.Mix.Tasks.Docs.beam)
  lib/mix/tasks/docs.ex:1

Generated ex_doc app
==> my_app
Compiling 6 files (.ex)
Generated my_app app
** (UndefinedFunctionError) function ExDoc.Config.default/1 is undefined or private. Did you mean one of:

      * default_formatter/0
      * default_source_ref/0

    (ex_doc) ExDoc.Config.default(:formatter)
    (ex_doc) lib/mix/tasks/docs.ex:213: Mix.Tasks.Docs.get_formatters/1
    (ex_doc) lib/mix/tasks/docs.ex:204: Mix.Tasks.Docs.run/3
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2

About a week ago, I had run mix doc on a different app, which was using version 0.20.2, and that had worked perfectly fine - I downgraded the version I was using for the app in question to match that, and was able to generate the docs, no problem.

My Elixir/Erlang version info:

Erlang/OTP 21 [erts-10.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.8.1 (compiled with Erlang/OTP 21)

I'm not sure if this is a bug or perhaps I'm missing something important, but wanted to bring it to your attention. Again, thank you so much for your time and efforts!

Most helpful comment

@darrenklein I'v encountered similar issue once, after running mix docs but unexpectedly when I'v triggered that command again docs has been generated without any issue.

All 4 comments

Hi @darrenklein

You probably have ex_doc on a certain environment (like dev or docs) and you are invoking ex_doc using another environment. Make sure to set MIX_ENV properly and it should work.

IN any case, we have also fixed master to have a nicer error message. :)

And thanks for the report!

@josevalim Terrific, thank you so much for your help (and everything you've done for the community)!

@darrenklein I'v encountered similar issue once, after running mix docs but unexpectedly when I'v triggered that command again docs has been generated without any issue.

Was this page helpful?
0 / 5 - 0 ratings