Could not load MyAshPhoenixApp.Blog, error: :nofile

I’m new to Ash and going through tutorials. In the AshPhoenix walkthrough, after the basic setup I’m getting the following error trying to create the database:

z@Serenity my_ash_phoenix_app % mix ash_postgres.create
** (Mix) Could not load MyAshPhoenixApp.Blog, error: :nofile.

There’s no other info to go on. The referenced walkthrough is: Ash Framework

Wondering if anyone has run into this error and knows what could cause it? I’ve checked the obvious. MyAskPhoenixApp.Blog is declared in my_ash_phoenix_app/blog/blog.ex:

defmodule MyAshPhoenixApp.Blog do
  use Ash.Api

  resources do
    registry MyAshPhoenixApp.Blog.Registry
  end
end

Confirmed that the right deps are included, etc… any help would be appreciated.

Using Elixir 1.15.7 / OTP 26, and these deps:

      {:ash, "~> 2.16.1"},
      {:ash_postgres, "~> 1.3.6"},
      {:ash_phoenix, "~> 1.1"}

Hi @zac :wave:

Sorry for the slow reply.

Can you show me the contents of your config/config.exs?

You bet! Hoping there are no embarrassing typos. :slight_smile: It’s the generated config, plus the two lines at the top from the AshPhoenix walkthrough docs. Here you go:

# This file is responsible for configuring your application
# and its dependencies with the aid of the Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.

# General application configuration
import Config

config :my_ash_phoenix_app,
  ash_apis: [MyAshPhoenixApp.Blog]

config :my_ash_phoenix_app,
  ecto_repos: [MyAshPhoenixApp.Repo],
  generators: [timestamp_type: :utc_datetime]

# Configures the endpoint
config :my_ash_phoenix_app, MyAshPhoenixAppWeb.Endpoint,
  url: [host: "localhost"],
  adapter: Phoenix.Endpoint.Cowboy2Adapter,
  render_errors: [
    formats: [html: MyAshPhoenixAppWeb.ErrorHTML, json: MyAshPhoenixAppWeb.ErrorJSON],
    layout: false
  ],
  pubsub_server: MyAshPhoenixApp.PubSub,
  live_view: [signing_salt: "cKy/s3Gh"]

# Configures the mailer
#
# By default it uses the "Local" adapter which stores the emails
# locally. You can see the emails in your browser, at "/dev/mailbox".
#
# For production it's recommended to configure a different adapter
# at the `config/runtime.exs`.
config :my_ash_phoenix_app, MyAshPhoenixApp.Mailer, adapter: Swoosh.Adapters.Local

# Configure esbuild (the version is required)
config :esbuild,
  version: "0.17.11",
  default: [
    args:
      ~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
    cd: Path.expand("../assets", __DIR__),
    env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
  ]

# Configure tailwind (the version is required)
config :tailwind,
  version: "3.3.2",
  default: [
    args: ~w(
      --config=tailwind.config.js
      --input=css/app.css
      --output=../priv/static/assets/app.css
    ),
    cd: Path.expand("../assets", __DIR__)
  ]

# Configures Elixir's Logger
config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id]

# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{config_env()}.exs"

Huh. Seems fine. This may seem like an oddball question but what is the file path of the MyAshPhoenixApp.Blog module?

No spaces or any other weirdness…

zac@Serenity blog % pwd
/Users/zac/Projects/Elixir/ash/my_ash_phoenix_app/blog
zac@Serenity blog % ls
./           ../          blog.ex      registry.ex  resources/
zac@Serenity blog % cat blog.ex
defmodule MyAshPhoenixApp.Blog do
  use Ash.Api

  resources do
    registry MyAshPhoenixApp.Blog.Registry
  end
end

right. the file needs to be in the lib directory of the project or Mix won’t compile it.

oh fer gawd sakes. Thanks. Sometimes it just takes another pair of eyes. :confused:

THANK YOU.

All good. Shit happens.