Running mix phx.new project_name should create all files, download and compile dependencies, install and compile node modules, then return to the command line.
Running mix phx.new project_name gets stuck. Output
...
* creating project_name/assets/static/images/phoenix.png
* creating project_name/assets/static/favicon.ico
Fetch and install dependencies? [Yn] Y
* running mix deps.get
* running mix deps.compile
* cd assets && npm install && node node_modules/brunch/bin/brunch build
## stuck here, nothing happens, no console output
I waited for about an hour, then quit using ctrl-c. Then I followed the steps manually.
mix deps.get said all dependencies were already up to datemix deps.compilenpm install, everything was already installednode node_modules/brunch/bin/brunch build and got the output: info: compiled 6 files into 2 files, copied 3 in 944 msSo if there was some sort of error that was thrown when I ran mix phx.new project_name, I didn't run into it. The command just failed silently, it seems.
Sorry if this has already been reported.
No worries, but this appears to be an obscure npm install issue that we won't be able to diagnose. You did the right next step by running the commands manually again and it sounds like things are now working so glad you're up to speed! Thanks for reporting!
I just run into the same issue, the manual steps work as expected.
@chrismccord, I don't think this is an npm error? I think it's getting hung up on deps.compile because when I un-quieted the commands, I saw a prompt from mix asking to install rebar. As this can never be responded to, this Task will never return.
Running mix local.rebar allowed the project creation to complete normally.
Great point @Zafira. We need to think about a solution for this.
@josevalim, I can also confirm that this issue is due to missing rebar.

This line in the installer https://github.com/phoenixframework/phoenix/blob/master/installer/lib/mix/tasks/phx.new.ex#L137 is compiling the downloaded dependencies during mix phx.new.
Since rebar is required during the compilation time, we have two options:
rebar during mix phx.newmix phx.new (since mix phx.server compiles the code if it's not already compiled, this can still be an option).I seem to be coming across a similar issue, after running mix phx.new projectName --no-ecto I get to the installing dependencies step and then the process just gets stuck on * running mix deps.compile.
Looking at the original report I did the same but:
events.js:165░░░░░░⸩ ⠙ extract:querystring-es3: sill extract [email protected]
throw er; // Unhandled 'error' event
^
I'm guessing that's what tripped it. Any ideas?
I'm following the official guide trying to install the _hello_ sample in Windows Subsystem for Linux (WSL) - Ubuntu 18.04. The install stucks at running mix deps.get:
kiatng@win10:~/phoenix$ mix phx.new hello
* creating hello/config/config.exs
* creating hello/config/dev.exs
* ...
* creating hello/assets/static/images/phoenix.png
* creating hello/assets/static/favicon.ico
Fetch and install dependencies? [Yn] Y
* running mix deps.get
^C
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
(v)ersion (k)ill (D)b-tables (d)istribution
^Ckiatng@win10:~/phoenix$ mix deps.get
** (Mix) Could not find a Mix.Project, please ensure you are running Mix in a directory with a mix.exs file
kiatng@win10:~/phoenix$ mix phx.new hello
The directory /home/kiatng/phoenix/hello already exists. Are you sure you want to continue? [Yn] n
** (Mix) Please select another directory for installation.
I'm a total noob.
[Update]
By following this guide, I manage to get the server up and running.
Here's are the commands continuing from ctrl+C above:
kiatng@win10:~/phoenix$ cd hello
kiatng@win10:~/phoenix/hello$ mix deps.get
Resolving Hex dependencies...
...
All dependencies up to date
After this, I made a mistake:
# wrong command
> kiatng@win10:~/phoenix/hello$ cd assets && npm install && node node_modules/brunch/bin/brunch build
# result in Error: Cannot find module '/home/kiatng/phoenix/hello/assets/node_modules/brunch/bin/brunch
Instead, it should be:
> kiatng@win10:~/phoenix/hello$ cd assets && npm install && node node_modules/webpack/bin/webpack.js --mode development
Continue:
kiatng@win10:~/phoenix/hello/assets$ cd ..
kiatng@win10:~/phoenix/hello$ mix ecto.create
==> file_system
Compiling 7 files (.ex)
...
Could not find "rebar3", which is needed to build dependency :ranch
I can install a local copy which is just used by Mix
Shall I install rebar3? (if running non-interactively, use "mix local.rebar --force") [Yn] Y
* creating /home/kiatng/.mix/rebar
...
warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch
lib/plug/conn/wrapper_error.ex:23
...
Compiling 13 files (.ex)
Generated hello app
** (Mix) The database for Hello.Repo couldn't be created: connection not available and request was dropped from queue after 2994ms. You can configure how long requests wait in the queue using :queue_target and :queue_interval. See DBConnection.start_link/2 for more information
kiatng@win10:~/phoenix/hello$ sudo service postgresql start
[sudo] password for kiatng:
* Starting PostgreSQL 10 database server [ OK ]
kiatng@win10:~/phoenix/hello$ mix ecto.create
12:21:00.294 [error] GenServer #PID<0.214.0> terminating
** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "postgres"
(db_connection) lib/db_connection/connection.ex:84: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Hello.Repo couldn't be created: killed
kiatng@win10:~/phoenix/hello$ sudo -u postgres psql
psql (10.6 (Ubuntu 10.6-0ubuntu0.18.04.1))
Type "help" for help.
postgres=# \password postgres
Enter new password:postgres
Enter it again:postgres
postgres=# \q
kiatng@win10:~/phoenix/hello$ mix ecto.create
The database for Hello.Repo has been created
kiatng@win10:~/phoenix/hello$ mix phx.server
[info] Running HelloWeb.Endpoint with cowboy 2.6.1 at http://localhost:4000
Webpack is watching the files…
...
[info] Sent 200 in 45ms
Most helpful comment
@chrismccord, I don't think this is an npm error? I think it's getting hung up on deps.compile because when I un-quieted the commands, I saw a prompt from mix asking to install rebar. As this can never be responded to, this Task will never return.
Running
mix local.rebarallowed the project creation to complete normally.