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

mix deps.get hangs on initial install #8887

Closed
danieljaouen opened this Issue Mar 12, 2019 · 15 comments

Comments

Projects
None yet
5 participants
@danieljaouen
Copy link

danieljaouen commented Mar 12, 2019

Environment

  • Elixir & Erlang/OTP versions (elixir --version):

Erlang/OTP 21 [erts-10.2.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Elixir 1.8.1 (compiled with Erlang/OTP 20)

  • Operating system:
    Ubuntu 2018.04

Current behavior

mix deps.get hangs upon initial install. If you Ctrl-C out of the session and run a mix deps.get again, it seems like everything is installed correctly.

Expected behavior

mix deps.get doesn't hang.

@danieljaouen

This comment has been minimized.

Copy link
Author

danieljaouen commented Mar 13, 2019

Strangely enough, this only occurs on my Ubuntu box and not on my Macbook. Maybe it has something to do with the fact that my Macbook is using asdf?

@danieljaouen

This comment has been minimized.

Copy link
Author

danieljaouen commented Mar 13, 2019

A common thread here seems to be running Ubuntu 18.04 using WSL. See: https://elixirforum.com/t/phx-new-hangs-at-running-mix-deps-get/20770/10

@ericmj

This comment has been minimized.

Copy link
Member

ericmj commented Mar 13, 2019

Please include:

  • the output from when you run mix deps.get to when it hangs.
  • the output for the second successful run of mix deps.get.
  • a copy of the mix.exs file

EDIT: formatting and more steps

@sfusato

This comment has been minimized.

Copy link
Contributor

sfusato commented Mar 13, 2019

Sorry to barge in. Coming here from the forum thread. Running Ubuntu 18.04 via WSL and experiencing the same.

the output from when you run mix deps.get to when it hangs:

mix phx.new phx_new
* creating phx_new/config/config.exs
* creating phx_new/config/dev.exs
* creating phx_new/config/prod.exs
* creating phx_new/config/prod.secret.exs
* creating phx_new/config/test.exs
* creating phx_new/lib/phx_new/application.ex
* creating phx_new/lib/phx_new.ex
* creating phx_new/lib/phx_new_web/channels/user_socket.ex
* creating phx_new/lib/phx_new_web/views/error_helpers.ex
* creating phx_new/lib/phx_new_web/views/error_view.ex
* creating phx_new/lib/phx_new_web/endpoint.ex
* creating phx_new/lib/phx_new_web/router.ex
* creating phx_new/lib/phx_new_web.ex
* creating phx_new/mix.exs
* creating phx_new/README.md
* creating phx_new/.formatter.exs
* creating phx_new/.gitignore
* creating phx_new/test/support/channel_case.ex
* creating phx_new/test/support/conn_case.ex
* creating phx_new/test/test_helper.exs
* creating phx_new/test/phx_new_web/views/error_view_test.exs
* creating phx_new/lib/phx_new_web/gettext.ex
* creating phx_new/priv/gettext/en/LC_MESSAGES/errors.po
* creating phx_new/priv/gettext/errors.pot
* creating phx_new/lib/phx_new/repo.ex
* creating phx_new/priv/repo/migrations/.formatter.exs
* creating phx_new/priv/repo/seeds.exs
* creating phx_new/test/support/data_case.ex
* creating phx_new/lib/phx_new_web/controllers/page_controller.ex
* creating phx_new/lib/phx_new_web/templates/layout/app.html.eex
* creating phx_new/lib/phx_new_web/templates/page/index.html.eex
* creating phx_new/lib/phx_new_web/views/layout_view.ex
* creating phx_new/lib/phx_new_web/views/page_view.ex
* creating phx_new/test/phx_new_web/controllers/page_controller_test.exs
* creating phx_new/test/phx_new_web/views/layout_view_test.exs
* creating phx_new/test/phx_new_web/views/page_view_test.exs
* creating phx_new/assets/webpack.config.js
* creating phx_new/assets/.babelrc
* creating phx_new/assets/css/app.css
* creating phx_new/assets/css/phoenix.css
* creating phx_new/assets/js/app.js
* creating phx_new/assets/js/socket.js
* creating phx_new/assets/package.json
* creating phx_new/assets/static/robots.txt
* creating phx_new/assets/static/images/phoenix.png
* creating phx_new/assets/static/favicon.ico

Fetch and install dependencies? [Yn] Y
* running mix deps.get

the output for the second successful run of mix deps.get:

mix deps.get
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  connection 1.0.4
  cowboy 2.6.1
  cowlib 2.7.0
  db_connection 2.0.5
  decimal 1.7.0
  ecto 3.0.7
  ecto_sql 3.0.5
  file_system 0.2.6
  gettext 0.16.1
  jason 1.1.2
  mime 1.3.1
  phoenix 1.4.1
  phoenix_ecto 4.0.0
  phoenix_html 2.13.1
  phoenix_live_reload 1.2.0
  phoenix_pubsub 1.1.2
  plug 1.7.2
  plug_cowboy 2.0.1
  plug_crypto 1.0.0
  postgrex 0.14.1
  ranch 1.7.1
  telemetry 0.3.0
All dependencies are up to date

a copy of the mix.exs file:

defmodule PhxNew.MixProject do
  use Mix.Project

  def project do
    [
      app: :phx_new,
      version: "0.1.0",
      elixir: "~> 1.5",
      elixirc_paths: elixirc_paths(Mix.env()),
      compilers: [:phoenix, :gettext] ++ Mix.compilers(),
      start_permanent: Mix.env() == :prod,
      aliases: aliases(),
      deps: deps()
    ]
  end

  # Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [
      mod: {PhxNew.Application, []},
      extra_applications: [:logger, :runtime_tools]
    ]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

  # Specifies your project dependencies.
  #
  # Type `mix help deps` for examples and options.
  defp deps do
    [
      {:phoenix, "~> 1.4.0"},
      {:phoenix_pubsub, "~> 1.1"},
      {:phoenix_ecto, "~> 4.0"},
      {:ecto_sql, "~> 3.0"},
      {: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

  # Aliases are shortcuts or tasks specific to the current project.
  # For example, to create, migrate and run the seeds file at once:
  #
  #     $ mix ecto.setup
  #
  # See the documentation for `Mix` for more info on aliases.
  defp aliases do
    [
      "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
      "ecto.reset": ["ecto.drop", "ecto.setup"],
      test: ["ecto.create --quiet", "ecto.migrate", "test"]
    ]
  end
end

Github of generated project: https://github.com/sfusato/phx_new

@ericmj

This comment has been minimized.

Copy link
Member

ericmj commented Mar 13, 2019

Can you show the output when selecting "N" when phoenix asks "Fetch and install dependencies? [Yn] " and then running mix deps.get manually. Unfortunately phoenix hides the output so we can't see what's going wrong.

@asummers

This comment has been minimized.

Copy link
Contributor

asummers commented Mar 13, 2019

Also coming from thread, per @josevalim's request

For me it was the initial mix phx.new on a fresh install of that task earlier in the day. No modifications. OSX Erlang 22 rc0, Elixir 1.7.4

If no one else gets to it, I can try the n and manual pull this evening.

Edit: Just tried, and the mix deps.get and mix deps.compile from the project itself after hitting N is significantly faster than the one from Phoenix itself after hitting Y.

@josevalim

This comment has been minimized.

Copy link
Member

josevalim commented Mar 13, 2019

@asummers

This comment has been minimized.

Copy link
Contributor

asummers commented Mar 13, 2019

It looks like this is the function that's hanging.

@ericmj

This comment has been minimized.

Copy link
Member

ericmj commented Mar 13, 2019

It is possible it isn't even mix deps.get that hangs.

Please also run npm install && node node_modules/webpack/bin/webpack.js --mode development in the assets/ directory.

@asummers

This comment has been minimized.

Copy link
Contributor

asummers commented Mar 13, 2019

That step was very fast for me (1-2s or so?), and appeared to have been completed before it tried to do mix deps.compile according to the output in console.

@ericmj

This comment has been minimized.

Copy link
Member

ericmj commented Mar 13, 2019

Keep in mind you should run it on a clean project generated with mix phx.new after selecting "N" when phoenix asks to fetch deps.

@asummers

This comment has been minimized.

Copy link
Contributor

asummers commented Mar 13, 2019

Ooops definitely ran on wrong project.

Answering Y:

❯ time mix phx.new hang
# ...
Fetch and install dependencies? [Yn] y
* running mix deps.get
* running cd assets && npm install && node node_modules/webpack/bin/webpack.js --mode development
* running mix deps.compile
# ...
mix phx.new hang  0.64s user 0.19s system 0% cpu 1:48.58 total

Answering N

❯ time mix phx.new hang2
# ...
Fetch and install dependencies? [Yn] n
# ...
mix phx.new hang2  0.56s user 0.14s system 37% cpu 1.856 total

~/Code
❯ time (cd hang2 && mix deps.get && mix deps.compile && cd assets && npm install && node node_modules/webpack/bin/webpack.js --mode development)
# ...
( cd hang2 && mix deps.get && mix deps.compile && cd assets && npm install &&)  70.67s user 17.73s system 147% cpu 1:00.07 total

Also I apparently bumped Elixir at some point in the past --

❯ elixir --version
Erlang/OTP 22 [DEVELOPMENT] [erts-10.0.1] [source-70b46d747d] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.8.1 (compiled with Erlang/OTP 22)
@josevalim

This comment has been minimized.

Copy link
Member

josevalim commented Mar 13, 2019

@sfusato

This comment has been minimized.

Copy link
Contributor

sfusato commented Mar 13, 2019

Can you show the output when selecting "N" when phoenix asks "Fetch and install dependencies? [Yn] " and then running mix deps.get manually. Unfortunately phoenix hides the output so we can't see what's going wrong.

Fetch and install dependencies? [Yn] n

We are almost there! The following steps are missing:

    $ cd phx_new_hangs
    $ mix deps.get
    $ cd assets && npm install && node node_modules/webpack/bin/webpack.js --mode development
...
mix deps.get
Resolving Hex dependencies...
Dependency resolution completed:
New:
  connection 1.0.4
  cowboy 2.6.1
  cowlib 2.7.0
  db_connection 2.0.5
  decimal 1.7.0
  ecto 3.0.7
  ecto_sql 3.0.5
  file_system 0.2.6
  gettext 0.16.1
  jason 1.1.2
  mime 1.3.1
  phoenix 1.4.1
  phoenix_ecto 4.0.0
  phoenix_html 2.13.1
  phoenix_live_reload 1.2.0
  phoenix_pubsub 1.1.2
  plug 1.7.2
  plug_cowboy 2.0.1
  plug_crypto 1.0.0
  postgrex 0.14.1
  ranch 1.7.1
  telemetry 0.3.0
* Getting phoenix (Hex package)
* Getting phoenix_pubsub (Hex package)
* Getting phoenix_ecto (Hex package)
* Getting ecto_sql (Hex package)
* Getting postgrex (Hex package)
* Getting phoenix_html (Hex package)
* Getting phoenix_live_reload (Hex package)
* Getting gettext (Hex package)
* Getting jason (Hex package)
* Getting plug_cowboy (Hex package)
* Getting cowboy (Hex package)
* Getting plug (Hex package)
* Getting mime (Hex package)
* Getting plug_crypto (Hex package)
* Getting cowlib (Hex package)
* Getting ranch (Hex package)
* Getting file_system (Hex package)
* Getting connection (Hex package)
* Getting db_connection (Hex package)
* Getting decimal (Hex package)
* Getting ecto (Hex package)
* Getting telemetry (Hex package)
cd assets && npm install && node node_modules/webpack/bin/web
pack.js --mode development

added 1002 packages from 592 contributors and audited 14911 packages in 227.697s

Hash: b9641d0ecef2b0845a5b
Version: webpack 4.4.0
Time: 3295ms
Built at: 3/13/2019 5:58:23 PM
                Asset       Size       Chunks             Chunk Names
       ../css/app.css   10.6 KiB  ./js/app.js  [emitted]  ./js/app.js
               app.js   7.23 KiB  ./js/app.js  [emitted]  ./js/app.js
       ../favicon.ico   1.23 KiB               [emitted]
        ../robots.txt  202 bytes               [emitted]
../images/phoenix.png   13.6 KiB               [emitted]
   [0] multi ./js/app.js 28 bytes {./js/app.js} [built]
[../deps/phoenix_html/priv/static/phoenix_html.js] 2.17 KiB {./js/app.js} [built]
[./css/app.css] 39 bytes {./js/app.js} [built]
[./js/app.js] 493 bytes {./js/app.js} [built]
    + 2 hidden modules
Child mini-css-extract-plugin node_modules/css-loader/index.js!css/app.css:
    [./node_modules/css-loader/index.js!./css/app.css] ./node_modules/css-loader!./css/app.css 288 bytes {mini-css-extract-plugin} [built]
    [./node_modules/css-loader/index.js!./css/phoenix.css] ./node_modules/css-loader!./css/phoenix.css 10.9 KiB {mini-css-extract-plugin} [built]
        + 1 hidden module

Individually everything runs smoothly.

Perhaps someone who runs Ubuntu as a stand-alone OS (not via WSL like me and the others who reported this issue) could check if he faces the same issue.

@josevalim

This comment has been minimized.

Copy link
Member

josevalim commented Mar 14, 2019

so there is a new phx_new version out that supports the --verbose flag for extra debugging. Please run mix archive.install hex phx_new and then mix phx.new foo --verbose so we can have more information on the root cause. I will close this one for now, since this discussion is already long and has two different issues, but a new issue with the new output and relevant information is welcome. Thank you!

@josevalim josevalim closed this Mar 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.