Phx.new hangs at "running mix deps.get"

I’m not what is happening but when I run “mix phx.new myapp” for 1.4 or “mix phoenix.new myapp” for 1.3 the script hangs at the “running mix deps.get” part. Does anyone know what is happening or how I can fix it?

Can you share the entire output? How long did you let it run before quitting? It also runs npm install after mix dips.get completes, which can take a while.

The last few lines are

* creating myapp/priv/repo/seeds.exs
* creating myapp/test/support/data_case.ex

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

I ran the command “mix phx.new myapp --no-html --no-webpack” and it still hangs with the same output as above. top shows the beam.smp program running at 200% CPU, so it’s doing something but there’s no output.

Very odd. If you ctrl-c out and cd into your app directory, followed by mix deps.get, do you get any other output?

Yes, that actually worked. I got the following output after mix deps.get in the myapp folder.

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

And mix phx.server and the localhost site works too. Yeah, I’m not sure what’s going on. It just seems to hang at the end of the phx.new script.

Did you recently change your mix.exs file?

This happen to me when I switch from guardian to coherence. When I was working with guardian I had some latest packages from bcrypt, comeonin, etc… then I decided to delete guardian and go coherence route. Mix complains because coherence some old versions. I deleted the offending packages that mix complains about. Ran mix deps.get again and it hanged. Took a good hour to realize I should delete other packages that I used with guardian and the hang stopped.

I’ve noticed the same issue when starting a new app and replying with ‘Yes’ to:

Fetch and install dependencies? [Yn]

The process seems stuck forever on * running mix deps.get

So, Ctrl+C, CD in, mix deps.get it’s almost instant, but from the output it seems they were successfully fetched previously even if the console output failed to report as such:

(output after running mix deps.get manually)

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

So, it gets the dependencies as it should, but for some reason doesn’t progresses to the next step.

This is on Ubuntu 18.04 running via WSL on Windows. I’ve just tested with a brand new project to confirm this.

Running the same directly on Windows it works as expected.

1 Like

I tried this yesterday on a MBP, and while it hung for a while, it eventually succeeded. The lack of verbose output at that step made me question what was going on, though, and almost made me Ctrl-c out of it.

Yes it was Ubuntu 18.04 running via WSL on Windows for me too. First time on this system installing the Phoenix 1.3.4 stack and it hung with phoenix.new. Then I uninstalled 1.3.4 and installed 1.4.1 and it had the same problem.

I’m seeing mix deps.get hang when trying to install elixir-lsp. Is this a bug with mix? This was also on Ubuntu 18.04 using WSL.

Works fine on my Macbook.

@sfusato @asummers can you please push one of those apps that took long to compile the first time to GitHub? It may be that you cannot reproduce it anymore, but if you have the app around (or at least its mix.exs file), it would be appreciated. You can post the mix.exs information here: https://github.com/elixir-lang/elixir/issues/8887

3 Likes

@josevalim It was the initial mix phx.new on a fresh install of that task. No modifications. OSX Erlang 22 rc0, Elixir 1.7.4

1 Like

@sfusato @asummers Phoenix 1.4.2 is out with a new --verbose switch which will hopefully let us know what’s going on when it hangs for you. Can you try the following when you have a moment?:

$ mix archive.install hex phx_new 1.4.2
$ mix phx.new my_app --verbose

Thanks!

5 Likes

Running with that flag, there’s nothing egregious happening as far as I can tell. Some of the larger dependencies, file count-wise (postgrex, ecto, e.g.) take longer, but nothing individually takes longer than it does in a normal project from what I can see. I always had an eventually successful build, though, so maybe @nwn may be better able to diagnose what’s happening on their end. The --verbose flag is very much appreciated, nonetheless =).

2 Likes

I installed 1.4.2 and ran mix phx.new myapp --no-webpack --verbose and these are the last few lines.

* creating myapp/priv/static/js/phoenix.js                                                                                                                                                              * creating myapp/priv/static/images/phoenix.png                                                                                                                                                         * creating myapp/priv/static/favicon.ico                                                                                                                                                                                                                                                                                                                                                                        Fetch and install dependencies? [Yn]                                                                                                                                                                    * running 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       

I waited 2-3 minutes before canceling it. Going in and running mix deps.get then shows that all dependencies are up to date.

1 Like

Can you please include the full output?

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

Fetch and install dependencies? [Yn] Y
* running 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.2
  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)

This is where it’s stuck for me. I waited 10 minutes on the clock before exiting.

Running mix deps.get afterwards:

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.2
  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
3 Likes

Unsure if related, but an interesting thing just happened…

I cloned one of my projects, ran mix deps.get on it, it went a couple of dependencies then just…stopped, after a couple of minutes it seemed to time out and said it couldn’t get something, but I ran mix deps.get again and it said everything was downloaded, even everything that was not yet listed as “Getting …” yet, it compiled and worked. It was very odd… Elixir 1.8.1 (compiled with Erlang/OTP 21)

1 Like

Could this be a CDN issue?

I was using a well known site recently that is quite heavy on the front end, but it started to become unresponsive/failed to load. Turned out two scripts weren’t loading - not sure whether they were corrupted or some other issue at the CDN.

2 Likes

Here is the full output when I ran mix phx.new myapp5 --no-webpack --verbose

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

Fetch and install dependencies? [Yn]
* running 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.2
  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)



^C
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution

Funny enough, yesterday it hung at the jason 1.1.2 line. Then earlier today it hung at the Getting ecto_sql line, then I ran it again and it hung at the next line, etc. I think I left this run running for 30 mins. Not at all qualified but does seem like a downloading or CDN issue because it keeps hanging after it’s downloaded a hex package.