Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not compile dependency :phoenix_ecto, "mix compile" failed #1953

Closed
ijunaid8989 opened this issue Sep 30, 2016 · 13 comments
Closed

Could not compile dependency :phoenix_ecto, "mix compile" failed #1953

ijunaid8989 opened this issue Sep 30, 2016 · 13 comments

Comments

@ijunaid8989
Copy link

Precheck

  • For help and support, use Stack Overflow or the Phoenix Talk mailing list
  • For proposing a new feature, start a discussion on the Phoenix Core mailing list
  • For bugs, do a quick search and make sure the bug has not yet been reported
  • Ensure that this issue is related to the Phoenix library and not one of the dependencies listed in mix.exs (Ecto, Plug, etc.)
  • All checked? Be nice and have fun!

Environment

  • Elixir version (elixir -v): 1.3.2
  • Phoenix version (mix deps): 1.1.6
  • NodeJS version (node -v): v6.0.0
  • NPM version (npm -v): 3.8.6
  • Operating system: Ubuntu

Expected behavior

mix ecto.create should work fine and create DB

Actual behavior

== Compilation error on file lib/phoenix_ecto/html.ex ==
** (KeyError) key :model not found in: %Phoenix.HTML.Form{data: nil, errors: {{:., [line: 12], [{:changeset, [line: 12], nil}, :errors]}, [line: 12], []}, hidden: [], id: {:name, [line: 10], nil}, impl: Phoenix.HTML.FormData.Ecto.Changeset, index: nil, name: {:name, [line: 11], nil}, options: [], params: %{}, source: {:changeset, [line: 8], nil}}
    (stdlib) :maps.update(:model, {:model, [line: 13], nil}, %Phoenix.HTML.Form{data: nil, errors: {{:., [line: 12], [{:changeset, [line: 12], nil}, :errors]}, [line: 12], []}, hidden: [], id: {:name, [line: 10], nil}, impl: Phoenix.HTML.FormData.Ecto.Changeset, index: nil, name: {:name, [line: 11], nil}, options: [], params: %{}, source: {:changeset, [line: 8], nil}})
    lib/phoenix_html/form.ex:170: anonymous fn/2 in Phoenix.HTML.Form.__struct__/1
    (elixir) lib/enum.ex:1623: Enum."-reduce/3-lists^foldl/2-0-"/3
    expanding struct: Phoenix.HTML.Form.__struct__/1
    lib/phoenix_ecto/html.ex:7: Phoenix.HTML.FormData.Ecto.Changeset.to_form/2

could not compile dependency :phoenix_ecto, "mix compile" failed. You can recompile this dependency with "mix deps.compile phoenix_ecto", update it with "mix deps.update phoenix_ecto" or clean it with "mix deps.clean phoenix_ecto"
@josevalim
Copy link
Member

@ijunaidfarooq can you try mix deps.update phoenix_ecto and let us know if it fixes it?

@ijunaid8989
Copy link
Author

ijunaid8989 commented Sep 30, 2016

@josevalim I have done this. Still the same issue.

@josevalim
Copy link
Member

@ijunaidfarooq oh, I see what is wrong. Try running mix local.phoenix to update your Phoenix archive so you generate an application with Phoenix v1.2 instead of v1.1.6.

@ijunaid8989
Copy link
Author

@josevalim Thanks Jose its resolved now.

Thanks for all your work You, Eric, Chris,.. are blessings to programming world.. Thanks again..

@josevalim
Copy link
Member

Great! I have also fixed Phoenix.Ecto so it also works on v1.1.6 :)

@ijunaid8989
Copy link
Author

:) Thanks.

@josevalim
Copy link
Member

josevalim commented Nov 28, 2016

For those looking into this, you can also fix it without updating your Phoenix version by changing the following dependencies in your mix.exs:

{:phoenix_html, "~> 2.6.0"},
{:phoenix_ecto, "~> 2.0.1"},

@andywenk
Copy link

Thanks for the info @josevalim . I could not get it to work with changing the deps in mix.exs so I installed phoenix.new from the github master branch with

mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

I pasted a huge load of stacktrace at https://gist.github.com/andywenk/06c3419c031ff029fe930e9b4ca57a84 if you want to look deeper into it. I left some free lines between the steps.

Thanks for all the awesome work!

@josevalim
Copy link
Member

@andywenk you should run mix compile after changing the deps. If I understand your stacktrace correctly, if you compile the dependency directly, then it was using its stale parents and not emitting the result you desired.

@andywenk
Copy link

andywenk commented Dec 1, 2016

@josevalim I am sure I also did run mix compile. But I played around a lot. What I remember is, that I fired mix local.phoenix what did not give the expected result. Then I changed the setting in mix.exs and did various things I can't remember exactly. I was also thinking, that somewhere old dependencies have been used but did not dig deeper because my solution did the trick. If it is important for finding the problem, I will try to reproduce what I did before.

@josevalim
Copy link
Member

@andywenk if updating to the dependencies above still raises after removing _build, I would love to have more information, but if you got it working there is no need to go back and reproduce because it is most likely something was left in a dirty state.

@josevalim
Copy link
Member

Thank you for the offer though! ❤️

@andywenk
Copy link

andywenk commented Dec 1, 2016

@josevalim ok then let's keep it with the result of 'there was a dirty state'. And you are welcome ;-)

batmany13 added a commit to ilonamm/askbywho that referenced this issue Jul 3, 2017
batmany13 added a commit to ilonamm/askbywho that referenced this issue Jul 3, 2017
* iniit phoenix repo

* update mix

* update

* add badge

* fix per phoenixframework/phoenix#1953

* update postgres version

* update config, install postgresql-client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants