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

Vercel部署时使用rsync提示command not found的解决方法咨询

Vercel部署时使用rsync提示command not found的解决方法咨询

我有一个Python脚本,作为静态站点项目yarn build的一部分运行,部署到Vercel。这个脚本用rsync做文件复制,通过Python里的os.system调用rsync:

os.system(f"rsync -a {full_path} dest_path")

本地运行完全没问题,但部署到Vercel时就报错:

sh: line 1: rsync: command not found

我还尝试了几种其他方法:

  • 使用subprocess.run通过npx来执行命令:
    subprocess.run(["npx", "rsync", "-a", full_path, dest_path], check=True)
    
    得到的Vercel构建错误:

    npm error could not determine executable to run

  • 尝试在package.json的开发依赖里添加rsync后重试,也没有解决问题
  • 最后还试过先获取rsync路径再执行:
    rsync_path = subprocess.check_output(["which", "rsync"]).decode("utf-8").strip()
    subprocess.run([rsync_path, "-a", full_path, dest_path], check=True)
    
    得到的Vercel构建错误:

    error Command failed with exit code 1.

想请教下有没有简单的方法能在Vercel部署过程中使用rsync?部署机器上到底有没有rsync?如果没有的话,该怎么配置才能用上rsync?

备注:内容来源于stack exchange,提问作者Blargian

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.14 15:37:59