The task ecto.create could not be found

Hello, we are using Windows 10 with Elixir version 1.14.2. We tried to run mix ecto.create but the error message says, The task ecto.create could not be found. Note no mix.exs found in the current directory.

But checking the files, mix.exs file was there. We tried to run mix help and we couldn’t find any command about ecto like ecto.create, ecto.load, ecto.migrate, etc.

What might be the reason or the fix for this? :pray:

I tried googling for possible solution but didn’t found a good one. Thanks in advance :pray::heart:

This may sound stupid, but are you sure you are cded into the directory? What does an ls output show?

Unfortunately, I am not on Windows, so I can’t be much help other than this.

Yes, i am sure we are in the main folder of the project and the dir command (equivalent of ls in Linux) shows all the folders and files of the project (including that mix.exs file)

I believe, the main reason why we can’t do mix ecto.create is because there’s no ecto.some_command that can be found when we run mix help.

But the question, why there’s no such ecto command available? And how can we possibly fix this issue?

Unfortunately, I am not on Windows, so I can’t be of much help other than that. I just didn’t want to leave you hanging too long without a response. Hopefully, someone else can be of value. :slight_smile:

1 Like

Hi @winsalva can you print the output of mix deps?

1 Like
* connection 1.1.0 (Hex package) (mix)
  locked at 1.1.0 (connection) 722c1eb0
* cowboy 2.9.0 (Hex package) (rebar3)
  locked at 2.9.0 (cowboy) 2c729f93
* cowboy_telemetry 0.3.1 (Hex package) (rebar3)
  locked at 0.3.1 (cowboy_telemetry) 3a6efd33
* cowlib 2.11.0 (Hex package) (rebar3)
  locked at 2.11.0 (cowlib) 2b3e9da0
* db_connection 2.4.2 (Hex package) (mix)
  locked at 2.4.2 (db_connection) 4fe53ca9
* decimal 2.0.0 (Hex package) (mix)
  locked at 2.0.0 (decimal) 34666e9c
* ecto 3.8.4 (Hex package) (mix)
  locked at 3.8.4 (ecto) f9244288
* ecto_sql 3.8.3 (Hex package) (mix)
  locked at 3.8.3 (ecto_sql) 348cb17f
* file_system 0.2.10 (Hex package) (mix)
  locked at 0.2.10 (file_system) 41195edb
* gettext 0.20.0 (Hex package) (mix)
  locked at 0.20.0 (gettext) 1c03b177
* jason 1.3.0 (Hex package) (mix)
  locked at 1.3.0 (jason) 53fc1f51
* mime 2.0.3 (Hex package) (mix)
  locked at 2.0.3 (mime) 27a30bf0
* phoenix 1.5.13 (Hex package) (mix)
  locked at 1.5.13 (phoenix) 1a7c4f19
* phoenix_ecto 4.4.0 (Hex package) (mix)
  locked at 4.4.0 (phoenix_ecto) 09864e55
* phoenix_html 2.14.3 (Hex package) (mix)
  locked at 2.14.3 (phoenix_html) efd697a7
* phoenix_live_dashboard 0.4.0 (Hex package) (mix)
  locked at 0.4.0 (phoenix_live_dashboard) 8d52149e
* phoenix_live_reload 1.3.3 (Hex package) (mix)
  locked at 1.3.3 (phoenix_live_reload) 76679667
* phoenix_live_view 0.15.7 (Hex package) (mix)
  locked at 0.15.7 (phoenix_live_view) 3a756cf6
* phoenix_pubsub 2.1.1 (Hex package) (mix)
  locked at 2.1.1 (phoenix_pubsub) 81367c6d
* plug 1.13.6 (Hex package) (mix)
  locked at 1.13.6 (plug) 02b9c6b9
* plug_cowboy 2.5.2 (Hex package) (mix)
  locked at 2.5.2 (plug_cowboy) ea6e87f7
* plug_crypto 1.2.2 (Hex package) (mix)
  locked at 1.2.2 (plug_crypto) 87631c7a
* postgrex 0.16.4 (Hex package) (mix)
  locked at 0.16.4 (postgrex) 3234d1a7
* ranch 1.8.0 (Hex package) (rebar3)
  locked at 1.8.0 (ranch) 49fbcfd3
* telemetry 0.4.3 (Hex package) (rebar3)
  locked at 0.4.3 (telemetry) eb72b836
* telemetry_metrics 0.6.1 (Hex package) (mix)
  locked at 0.6.1 (telemetry_metrics) 7be9e087
* telemetry_poller 0.5.1 (Hex package) (rebar3)
  locked at 0.5.1 (telemetry_poller) 4cab7206

Great so ecto is on your deps list, if you mix deps.get and mix deps.compile do you get output that indicates that ecto has compiled?

It was throwing an error like it can’t find the Mix.Project.

We did execute mix deps.get after we download a copy of our project from github and that was last week.

The reason it took us almost a week before we were able to run mix ecto.create was because of the postgres errors we encountered.

After reading your suggestion sir, we retried mix deps.get and that’s were we realize that the project’s folder was probably corrupted.

So we downloaded a new copy again, run mix deps.get, mix compile and check mix help, and the ecto.some_command is now available :pray:

That you for your suggestions sir, we finally found the cause of the error. :heart:

1 Like