Unable to run any mix commands (Error)


I cannot run any of the mix commands I get this same error:

explorers@steak:~/explorers/nrg$ mix phx.gen.secret
** (Mix.Config.LoadError) could not load config apps/block_scout_web/config/config.exs
** (UndefinedFunctionError) function System.get_env/2 is undefined or private. Did you mean one of:

  * get_env/0
  * get_env/1

(elixir) System.get_env("SHOW_ADDRESS_MARKETCAP_PERCENTAGE", "true")
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
(stdlib) erl_eval.erl:469: :erl_eval.expr/5
(stdlib) erl_eval.erl:269: :erl_eval.expr/5
(stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
(stdlib) erl_eval.erl:236: :erl_eval.expr/5
(stdlib) erl_eval.erl:228: :erl_eval.expr/5
(stdlib) erl_eval.erl:229: :erl_eval.expr/5

I have scoured the installation docs and I am not missing anything… I have elixir installed.

Please help thanks

I didnt use brew to install any of the requirements so I am trying installing brew will post back if it works

[EDIT] Turns out even installing all the requirements with brew instead of APT it still gives the same error. I cannot for the life of me figure out why it wont run any mix commands. It should work out of the box I would think if others have it working…

[EDIT2] I am not sure what I did, but now the commands are working. I will post back if more problems but it looks like things will go well now.

Hi, which version of Erlang/Elixir do you use? It looks like your version is less than required.

1 Like

elixir is already the newest version (1.10.2-1).
erlang is already the newest version (1:22.3.2-1).
postgresql is already the newest version (12+213.pgdg18.04+1).

Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1]
Elixir 1.10.2 (compiled with Erlang/OTP 21)

The problem has changed. I got everything working (even got the web UI loaded) except for the database migrate command it fails like this:

02:46:00.376 [info]  == Running 20181015173318 Explorer.Repo.Migrations.AddCaseInsensitiveExtension.change/0 forward

02:46:00.376 [info]  == Migrated 20181015173318 in 0.0s

02:46:00.379 [info]  == Running 20181015173319 Explorer.Repo.Migrations.ModifyUsersUsername.up/0 forward

02:46:00.380 [info]  drop index unique_username

02:46:00.381 [info]  alter table users
** (Postgrex.Error) ERROR 42704 (undefined_object) type "citext" does not exist
    (ecto_sql 3.3.2) lib/ecto/adapters/sql.ex:629: Ecto.Adapters.SQL.raise_sql_call_error/1
    (elixir 1.10.2) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
    (ecto_sql 3.3.2) lib/ecto/adapters/sql.ex:716: Ecto.Adapters.SQL.execute_ddl/4
    (ecto_sql 3.3.2) lib/ecto/migration/runner.ex:343: Ecto.Migration.Runner.log_and_execute_ddl/3
    (ecto_sql 3.3.2) lib/ecto/migration/runner.ex:117: anonymous fn/6 in Ecto.Migration.Runner.flush/0
    (elixir 1.10.2) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ecto_sql 3.3.2) lib/ecto/migration/runner.ex:116: Ecto.Migration.Runner.flush/0
    (stdlib 3.12.1) timer.erl:166: :timer.tc/1
    (ecto_sql 3.3.2) lib/ecto/migration/runner.ex:25: Ecto.Migration.Runner.run/7
    (ecto_sql 3.3.2) lib/ecto/migrator.ex:342: Ecto.Migrator.attempt/7
    (ecto_sql 3.3.2) lib/ecto/migrator.ex:242: anonymous fn/4 in Ecto.Migrator.do_up/4
    (ecto_sql 3.3.2) lib/ecto/migrator.ex:324: anonymous fn/3 in Ecto.Migrator.run_maybe_in_transaction/6
    (ecto_sql 3.3.2) lib/ecto/adapters/sql.ex:903: anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4
    (db_connection 2.2.0) lib/db_connection.ex:1427: DBConnection.run_transaction/4
    (ecto_sql 3.3.2) lib/ecto/migrator.ex:323: Ecto.Migrator.run_maybe_in_transaction/6
    (elixir 1.10.2) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (elixir 1.10.2) lib/task/supervised.ex:35: Task.Supervised.reply/5
    (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

I assume the database needs to properly fully migrate… Is this a postgresql version issue then?

Will see if I can find Elixir 1.9.1 and install it somehow manually

Ok so here’s the solution!

I was using a fork of blockscout, so I downloaded original blockscout and ran the commands up to the database drop, create, migrate and then switched back to the forked version to run it and it works!

Thanks so much for your help viktorbaranov POA Team

1 Like