Mix ash.gen.domain | function Igniter.Mix.Task.Info.global_options/0 is undefined | module Igniter.Mix.Task.Info is not available

Hey all,

I’m relatively new to all this so most likely I’m doing something dumb

All the ash generators

mix ash.gen.domain
mix ash.gen.resource
etc

are giving me the same error.

** (UndefinedFunctionError) function Igniter.Mix.Task.Info.global_options/0 is undefined (module Igniter.Mix.Task.Info is not available)
    Igniter.Mix.Task.Info.global_options()
    lib/mix/tasks/gen/ash.gen.domain.ex:13: Mix.Tasks.Ash.Gen.Domain.run/1
    (mix 1.17.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.17.2) lib/mix/cli.ex:96: Mix.CLI.run_task/2
    /usr/local/bin/mix:2: (file)

It seems like the Ash generators aren’t aware of Igniter. I can see igniter in my deps/ folder (v 0.3.9), and Ash (v 3.2.6) is also in that same deps folder.

I’ve also previously done a global install on igniter.new as per the ash documentation

mix archive.install hex igniter_new

and used that tool to successfully create a new project using

mix igniter.new helpdesk --install ash,ash_postgres

The error points to line 13 on ash.gen.domain, which is this line:

use Igniter.Mix.Task

then looking inside Igniter.Mix.Task ( in deps/ingniter/lib/mix/task.ex ). I can see this code

defmodule Info do
    ## module doc....
 
    @global_options [
      switches: [
        dry_run: :boolean,
        yes: :boolean,
        check: :boolean
      ],
      # no aliases for global options!
      aliases: []
    ]

    ## skipping more code...

     def global_options, do: @global_options
  end

Seems to me function Igniter.Mix.Task.Info.global_options/0 is clearly there?

Thanks for any help or suggestions :))

Hmm…this is definitely strange. Out of curiosity, what happens if you do

rm -rf _build
mix compile

and then run a generator?

1 Like

Same error unfortunately.

I’ve also tried deleting deps folder, deleting mix.lock, and playing with different versions of both Ash and Igniter, and of course running mix deps.get && mix deps.compile every time

:thinking: that is super strange… I can’t reproduce this on the latest versions :thinking:

I honestly can’t think of any reason why that would be happening given that we’re on the same versions :thinking: can you push your project to GH? Maybe there is some issue w/ it that will allow me to reproduce on my machine.

rm -rf ~/.hex/cache.ets you might also try deleting the hex cache and reinstalling deps?

I’ve sent you an invite, but I’m getting the same issue when I create a new test project also. Seems more like something’s going wrong with my set up than the code itself, but I can’t figure out what it could possibly be

I tried your project and it did work for me so as you said its got to be something on your machine (which is very very very strange). Hmmm…what are your elixir/erlang versions?

Did you happen to install an older version of igniter as an archive?

maybe one of our guides is telling people to mix archive.install hex igniter instead of mix archive.install hex igniter_new?

Thanks for the help all, solved :))

After axelson’s response I removed everything in archives except hex ( ~/Users/[my_user]/.mix/archives on Mac OS )

Everything works correctly now – not sure what was causing the issue as I removed all at once, but something was.
I noticed I had folders for ash, igniter and igniter_new. Maybe one of these was out of date or conflicted with the version in my project’s deps.

Thanks again

1 Like

I had installed igniter in archives, but it’s most likely my mistake not something from the guides.

1 Like