I'm having trouble getting my Elixir apps to read the MIX_ENV
variable from the local environment on my Mac. For example, running the command
$ MIX_ENV=prod iex -S mix
throws the following error:
** (FunctionClauseError) no function clause matching in String.split/3
The following arguments were given to String.split/3:
# 1
nil
# 2
" "
# 3
[]
Attempted function clauses (showing 4 out of 4):
def split(string, %Regex{} = pattern, options) when is_binary(string)
def split(string, "", options) when is_binary(string)
def split(string, pattern, []) when is_tuple(pattern) or is_binary(string)
def split(string, pattern, options) when is_binary(string)
(elixir) lib/string.ex:407: String.split/3
(stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
(stdlib) erl_eval.erl:888: :erl_eval.expr_list/6
(stdlib) erl_eval.erl:240: :erl_eval.expr/5
(stdlib) erl_eval.erl:232: :erl_eval.expr/5
(stdlib) erl_eval.erl:888: :erl_eval.expr_list/6
(stdlib) erl_eval.erl:411: :erl_eval.expr/5
(stdlib) erl_eval.erl:126: :erl_eval.exprs/5
This also occurs if I set the MIX_ENV
in a separate step.
From the documentation at https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html, it looks to me like I'm doing this correctly, but it would seem that I'm not. Is there a different way that I need to set this?
As noted, I'm working on a Mac, Mojave 10.14.6, and my Elixir version is 1.8.1.