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

Ubuntu环境下Supervisor无法找到Vapor应用Run命令问题求助

解决步骤
  • 核心问题:Vapor新版本可执行文件名并非Run
    你搭配Swift 5.8使用的是Vapor 4+版本,这个版本默认的可执行文件名称是App,而非旧文档里标注的Run——这就是你在.build/release目录下找不到Run文件的根本原因。

  • 修正Supervisor配置文件
    编辑/etc/supervisor/conf.d/hello.conf,将command行里的Run替换为App:

    [program:hello]
    command=/home/vapor/hello/.build/release/App serve --env production
    directory=/home/vapor/hello/
    user=vapor
    stdout_logfile=/var/log/supervisor/%(program_name)-stdout.log
    stderr_logfile=/var/log/supervisor/%(program_name)-stderr.log
    
  • 验证编译结果
    先确认release编译后的可执行文件存在:

    ls /home/vapor/hello/.build/release/App
    

    如果文件存在,直接测试运行是否正常:

    /home/vapor/hello/.build/release/App serve --env production --hostname 0.0.0.0 --port 8080
    
  • 重新加载Supervisor配置
    执行以下命令更新配置并启动服务:

    supervisorctl reread
    supervisorctl update hello
    supervisorctl start hello
    

    若之前已添加过hello服务,也可以先停止再重启:

    supervisorctl stop hello
    supervisorctl restart hello
    
  • 额外排查点
    如果问题仍存在,检查以下内容:

    1. 重新执行swift build -c release,查看编译输出是否有错误信息
    2. 确认vapor用户对.build/release/App有执行权限:ls -l /home/vapor/hello/.build/release/App,确保权限包含x标识
    3. 之前报错的异常路径(/home/vapor/hello/release/.build/Run)是旧配置残留,重新加载后会自动修正

内容的提问来源于stack exchange,提问作者Ben

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.18 12:57:09