Search code examples
elixirdocumentationelixir-mix

The task "docs" could not be found. Did you mean "do"?


How to generate documentation for mix project? How it can do it?

The procedure for working with the Elixir mix-project:

  • I generate a project by mix new greeter command.
  • I add a block of comments in the greeter.ex file.
  • I add dependencies to the mix.exs file.
  • I try to generate documentation by mix docs command.

mix help can not provide docs task in a list of possible options:

mix                   # Runs the default task (current: "mix run")
mix app.start         # Starts all registered apps
mix app.tree          # Prints the application tree
mix archive           # Lists installed archives
mix archive.build     # Archives this project into a .ez file
mix archive.install   # Installs an archive locally
mix archive.uninstall # Uninstalls archives
mix clean             # Deletes generated application files
mix cmd               # Executes the given command
mix compile           # Compiles source files
mix deps              # Lists dependencies and their status
mix deps.clean        # Deletes the given dependencies' files
mix deps.compile      # Compiles dependencies
mix deps.get          # Gets all out of date dependencies
mix deps.tree         # Prints the dependency tree
mix deps.unlock       # Unlocks the given dependencies
mix deps.update       # Updates the given dependencies
mix dialyzer          # Runs dialyzer with default or project-defined flags.
mix dialyzer.build    # Build the required plt(s) and exit.
mix dialyzer.clean    # Delete plt(s) and exit.
mix dialyzer.explain  # Display information about dialyzer warnings.
mix do                # Executes the tasks separated by comma
mix escript           # Lists installed escripts

When I run mix docs command I get a mix-message:

**(Mix) The task "docs" could not be found. Did you mean "do"?

Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  earmark 1.3.2
  ex_doc 0.20.2
  makeup 0.8.0
  makeup_elixir 0.13.0
  nimble_parsec 0.5.0
All dependencies are up to date

What is my mistake?


Solution

  • I remove _build directory, remove all content of deps directory, remove mix.lock.

    Then in a command line of mix-project I do commands:

    1. mix deps.clean --all
    2. mix deps.update --all
    3. mix deps.get --all

    After that, I run mix docs and documentation was generated.

    Command mix help docs print ExDoc documentation too.