最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - command not found when trying to use rsync on Vercel - Stack Overflow

programmeradmin1浏览0评论

I have a python script which runs as part of yarn build for my static-site project deployed to Vercel. The script uses rsync to do some file copying, using os.system to make the call to rsync from within the python script: os.system(f"rsync -a {full_path} dest_path"). This works great locally, however when I try to deploy to Vercel I get the error:

sh: line 1: rsync: command not found

I tried a few other approaches as well:

  • using subprocess.run(["npx", "rsync", "-a", full_path, dest_path], check=True) to try get npx to run the command.

Vercel build error:

npm error could not determine executable to run
  • Tried adding rsync to my developer dependencies in package.json and retrying.

  • Finally I also tried using rsync_path = subprocess.check_output(["which", "rsync"]).decode("utf-8").strip() subprocess.run([rsync_path, "-a", full_path, dest_path], check=True)

Vercel build error:

error Command failed with exit code 1.

Is there a simple way for me to use rsync during my Vercel deployment? Does it even exist on the deployment machine? If not how can I set it up to use rsync?

发布评论

评论列表(0)

  1. 暂无评论