简体   繁体   中英

Can't run any mix command - ** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1

I have the exact same code and versions on my local mac and can run the mix commands fine. I pulled a completely fresh copy of my project to make sure. There is no _build, deps, or tmp directory. This error gives no information into the problem. What could be happening or what could I look into to solve this?

The problem is on Ubuntu 18.04 LTS. I have tried multiple erlang/elixir versions and all result in the same output below.

root@instance-1:/srv/zipbooks/phoenix-api# elixir -v
Erlang/OTP 21 [erts-10.2.5] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]

Elixir 1.8.1 (compiled with Erlang/OTP 21)
root@instance-1:/srv/zipbooks/phoenix-api# mix compile
** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1    

    The following arguments were given to IO.chardata_to_string/1:

        # 1
        nil

    Attempted function clauses (showing 2 out of 2):

        def chardata_to_string(string) when is_binary(string)
        def chardata_to_string(list) when is_list(list)

    (elixir) lib/io.ex:461: IO.chardata_to_string/1
    (elixir) lib/path.ex:512: Path.join/2
    (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:233: :erl_eval.expr/5
    (stdlib) erl_eval.erl:888: :erl_eval.expr_list/6

The issue appears to be that a nil value is being passed to IO.chardata_to_string . If you run iex and enter:

IO.chardata_to_string(nil)

you'll receive the same error. Now, if you enter something like:

IO.chardata_to_string("my string")

you'll get the result you likely expect.

Without seeing your code, I can't say why you're getting the nil value that's being passed to IO.chardata_to_string, but that seems to be the issue.

I hope that helps.

Cheers!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM