JohnSmall

JohnSmall

I’m working my way through the Programming Phoenix > 1.4 book and I’ve got a problem with the formatter.

I’m using Atom with Elixir addons, which calls the formatter and reports errors and autofixes the format. But the formatter doesn’t like the migrations. I get this error

** (Mix) Unknown dependency :ecto_sql given to :import_deps in the formatter configuration. The dependency is not listed in your mix.exs for environment :dev

Which is odd because :ecto_sql is very definitely in the list of dependencies in mix.exs, though there isn’t a specific environment for :dev section.

Since this is a plain installation, and follows the book, I’m assuming that other people have the same problem, but I can’t see any other questions being asked.

Anyone have any idea how I get this fixed?

Showing Posts 1 to 10

goofansu

goofansu

Hi @JohnSmall, the error happens if the mix format command runs in wrong directory. I guess it is caused by the Elixir plugin used in Atom. You can try VSCode and install the “ElixirLS Fork” extension.

hassan

hassan

Which addons exactly? What version of Elixir / Erlang / Phoenix?
Does the formatter give the same error if you run it from the command line?

For reference, I don’t see any such errors with these installed:

  • atom-elixir 0.2.3
  • atom-elixir-formatter 1.0.6
  • language-elixir 0.23.0
  • linter-elixir-credo 1.1.0
benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Hi @JohnSmall did you per chance use the latest version of ecto instead of the version specified in the Phoenix book? In the latest version of Ecto, you need to add :ecto_sql as an additional dependency now, it was extracted from ecto proper.

JohnSmall

JohnSmall OP

Yes it is the latest version of Phoenix. But it’s automatically added :ecto_sql to deps in mix.exs. Here’s the code

defp deps do
    [
      {:phoenix, "~> 1.4.11"},
      {:phoenix_pubsub, "~> 1.1"},
      {:phoenix_ecto, "~> 4.0"},
      {:ecto_sql, "~> 3.1"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 2.11"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      {:gettext, "~> 0.11"},
      {:jason, "~> 1.0"},
      {:plug_cowboy, "~> 2.0"}
    ]
  end

As you can see :ecto_sql is definitely there.

JohnSmall

JohnSmall OP

Good point, what happens when I run from the command line? Ans: no errors.

Which prompts the question where are the Atom addons getting the error message from? I’m using

  • atom-elixir 0.2.3
  • atom-elixir-formatter 1.0.6
  • language-elixir 0.23.0
  • linter-elixir-credo 1.1.0

Exactly the same as you. Are there special settings that have to be configured for these addons?

NobbZ

NobbZ

Do you start your editor from a GUI or from the terminal, if you open it from the terminal, do you see the same error?

JohnSmall

JohnSmall OP

I get the same error if I start Atom from the command line as I do when starting it from the Mac dock toolbar.

Well not quite the same error, the error comes up twice instead of just once.

JohnSmall

JohnSmall OP

By disabling and enabling the packages I can see that the error is generated by atom-elixir-formatter v1.0.6.

There doesn’t seem to be much configuration that can be changed, other than the executable it calls. Which is the default elixir.

I checked the Github repo for the package and found other people with the same problem Running in subdirectory with `.formatter.exs` file breaks · Issue #26 · rgreenjr/atom-elixir-formatter · GitHub but the author doesn’t have time to fix it. Sigh :frowning:

NobbZ

NobbZ

Just to make sure, do you start it from the project folder than?

Quite often those problems arise from the processes working dir is incorrect.

JohnSmall

JohnSmall OP

Just tried it and it makes no difference. Which is reasonable because it checks the formats on all other files in the project correctly.

If I had to start Atom from the command line in the root directory of the project to get it to work that would be crazy as I have 5 projects open at once.

As the author doesn’t have time to fix the problem I’ll investigate a bit to see if I can diagnose what’s going wrong.

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews