Capistrano 在应用部署中无法找到 Gemfile 的错误

7
我将尝试将我的Rails应用程序部署到生产服务器,并决定使用这个指南 + RVM将其部署到DigitalOcean。
我使用以下命令进行部署:
cap production deploy

然而,它在需要gemfile的某些部分失败了。以下是部署失败的日志:
DEBUG[323dfd0e] Command: cd /home/deploy/zwiadowcy/releases/20140628164657 && ~/.rvm/bin/rvm default do bundle install --binstubs /home/deploy/zwiadowcy/shared/bin --path
/home/deploy/zwiadowcy/shared/bundle --without development test --deployment --quiet
DEBUG[323dfd0e]     Could not locate Gemfile
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host my_ip_address: bundle exit status: 10
bundle stdout: Nothing written
bundle stderr: Nothing written

我的Gemfile已经包含了所有必需的内容:

gem 'capistrano', '~> 3.1.0'
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1.1'
gem 'capistrano-rvm', github: "capistrano/rvm"

我已经在Google上搜索了大量的信息,尝试了许多方法,并查看了很多问题。现在我已经不知道该怎么办了,所以我恳求您的帮助。谢谢!


你的 Gemfile 是否已经提交? - Frederick Cheung
我该如何检查这个? - xShivan
请检查您的代码库是否正在跟踪Gemfile?或者查看项目根目录中的.gitignore文件,以查看是否错误地将Gemfile放在那里。 - Surya
那似乎是一个不错的方向,Icicle。我的git存储库结构是:根目录和一些东西/实际的rails应用程序。 - xShivan
你是否通过运行 git init . 在本地应用程序中初始化了 Git? - Icicle
显示剩余4条评论
1个回答

2

请确保GemfileGemfile.lock已经被提交到Git。例如,您可以运行以下命令:

git log Gemfile
git log Gemfile.lock

您还可以验证这些文件是否存在于服务器上的 /home/deploy/zwiadowcy/releases/20140628164657 目录中。

在服务器上手动运行该命令也会有所帮助:

cd /home/deploy/zwiadowcy/releases/20140628164657 && ~/.rvm/bin/rvm default do bundle install --binstubs /home/deploy/zwiadowcy/shared/bin --path /home/deploy/zwiadowcy/shared/bundle --without development test --deployment

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接