You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CentOS系统下执行mix new app_first失败问题求助

Elixir mix命令启动失败的解决方法

问题现状

CentOS系统中,Erlang/OTP 24与Elixir 1.14.0版本验证正常,但执行mix命令时触发崩溃,错误栈指向Kernel.CLI.Config的update_commands调用参数异常。

环境验证信息

  • Erlang版本正常:
github@localhost:$ erl
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
  • Elixir版本正常:
github@localhost:~/elixir-otp-24$ bin/elixir --version
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Elixir 1.14.0 (compiled with Erlang/OTP 24)

mix命令错误输出

github@localhost:~/elixir-otp-24$ bin/mix
{"init terminating in do_boot",{badarg,[{erlang,apply,[{'Elixir.Kernel.CLI.Config',[],<<".">>,[],true,[],[],false},update_commands,[#Fun<Elixir.Kernel.CLI.18.41400255>]],[{error_info,#{module=>erl_erts_errors}}]},{'Elixir.Kernel.CLI',process_argv,2,[{file,"lib/kernel/cli.ex"},{line,191}]},{'Elixir.Kernel.CLI',main,1,[{file,"lib/kernel/cli.ex"},{line,14}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({badarg,[{erlang,apply,[{_},update_commands,[_]],[{_}]},{Elixir.Kernel.CLI,process_argv,2,[{_},{_}]},{Elixir.Kernel.CLI,main,1,[{_},{_}]},{init,start_em,1,[]},{init,do_boot,3,[]}]})

Crash dump is being written to: erl_crash.dump...done

可行修复步骤

  1. 补全CentOS基础依赖
    CentOS编译运行Elixir需要底层依赖支持,执行以下命令安装:
sudo yum install -y gcc gcc-c++ make openssl-devel ncurses-devel
  1. 重新编译Elixir并配置全局环境
    先确保Erlang全局可用,将Erlang的bin目录加入系统PATH:
export PATH=$PATH:/path/to/erlang/bin

然后清理旧编译文件重新编译(替换为对应版本分支):

cd ~/elixir-otp-24
make clean
rm -rf _build
make
make install
  1. 避免在Elixir编译目录执行命令
    将编译后的Elixir目录加入全局PATH:
export PATH=$PATH:~/elixir-otp-24/bin

切换到任意非Elixir编译目录,执行mix new app_first测试。

  1. 替换为官方稳定版Erlang
    若使用自定义编译的Erlang,建议改用Erlang Solutions的官方包:
sudo yum install -y https://packages.erlang-solutions.com/erlang-solutions-2.0-1.noarch.rpm
sudo yum install -y erlang

之后重新安装对应版本的Elixir。

内容的提问来源于stack exchange,提问作者孙海城

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 12:10:34