Rails 4, Capistrano 3.0.0,不能加载这样的文件部署。

时间:2022-03-07 20:37:57

I just ran bundle update and capistrano got updated to 3.0.0 but now when I run cap deploy I get an error and can't figure out how to fix this. I have been updating my server every day without problem until this update.

我只是运行了bundle update, capistrano更新到3.0.0,但是现在当我运行cap部署时,我得到一个错误,不能解决这个问题。在这次更新之前,我每天都在毫无问题地更新我的服务器。

cap aborted!
cannot load such file -- deploy
/home/mark/rails_apps/myapp/Capfile:1:in `load'
/home/mark/rails_apps/myapp/Capfile:1:in `<top (required)>'

capfile

capfile

load 'deploy'
load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks

9 个解决方案

#1


19  

I had to run gem uninstall capistrano

我不得不运行gem卸载capistrano

then update the gemfile with gem 'capistrano', '~> 2.15'

然后用gem 'capistrano'、'~> 2.15'更新gemfile

and then run to reinstall the correct version again with bundle update capistrano

然后使用bundle update capistrano重新安装正确的版本

#2


39  

I had to gem uninstall capistrano and selected version 3.0.0

我不得不卸载capistrano并选择了3.0.0版本

(i.e. downgraded the gem to 2.x)

(即将创业板降至2.x)

#3


17  

Make sure you are using bundle exec (most likely you have multiple gem versions of capistrano)

确保您正在使用bundle exec(很可能有多个capistrano的gem版本)

i.e.

即。

bundle exec cap -T

包exec帽- t

#4


7  

Instead of downgrading to Capistrano 2 use the new configuration from the current version.

不要降级到Capistrano 2,使用当前版本的新配置。

require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"

See also this nice posting, which summarises the differences between Capistrano 2 and 3.

你也可以看看这篇不错的文章,它总结了Capistrano 2和3的不同之处。

#5


4  

Add the related gems to your Gemfile

将相关的宝石添加到Gemfile中

i.e. for

例如

gem 'capistrano-bundler' # for capistrano/bundler
gem 'capistrano-rails' # for capistrano/rails/*

Do not downgrade to 2.x for this.

不要降级为2。x。

#6


2  

I had this problem today and pastullo's solution above fixed it except that I had to run gem uninstall capistrano (as markhorrocks answered) not bundle uninstall capistrano.

我今天遇到了这个问题,帕斯图洛的解决方案解决了这个问题,除了我必须运行gem卸载capistrano(正如markhorrocks所回答的)而不是捆绑卸载capistrano。

I also found this blog on bundler very useful: http://viget.com/extend/bundler-best-practices

我还发现bundler的博客非常有用:http://viget.com/extend/bundler-最佳实践

Thanks for sharing this as it saved me heaps of time. x

谢谢分享,因为它节省了我很多时间。x

#7


2  

The fastest way to fix this I have found is to backup the cap files (Capfile, config/deploy.rb, and config/deploy/*.rb) and then re capify (it's no longer called "capify"):

解决这个问题的最快方法是备份cap文件(Capfile, config/deploy)。rb,配置/部署/*.rb),然后重新进行capify(不再称为capify):

bundle exec cap install STAGES=staging,production

Then recreate your cap files from your backup. It will take you 5 minutes to do this and you'll be over the major Capistrano upgrade hump.

然后从备份中重新创建cap文件。你要花5分钟来完成这个任务,你将会越过卡皮斯特拉诺升级峰。

#8


0  

I used

我使用

bundle exec cap production deploy

bundle exec cap生产部署

instead of just cap production deploy

而不仅仅是限制生产部署

#9


0  

in my case I have changed my project ruby version. may be bundle also work here.

在我的情况下,我已经更改了我的项目ruby版本。也可能是捆绑在这里工作。

but I changed it to back what it was in previously.

但我把它改成了原来的样子。

ex:

例:

rbenv local 2.4.1

#1


19  

I had to run gem uninstall capistrano

我不得不运行gem卸载capistrano

then update the gemfile with gem 'capistrano', '~> 2.15'

然后用gem 'capistrano'、'~> 2.15'更新gemfile

and then run to reinstall the correct version again with bundle update capistrano

然后使用bundle update capistrano重新安装正确的版本

#2


39  

I had to gem uninstall capistrano and selected version 3.0.0

我不得不卸载capistrano并选择了3.0.0版本

(i.e. downgraded the gem to 2.x)

(即将创业板降至2.x)

#3


17  

Make sure you are using bundle exec (most likely you have multiple gem versions of capistrano)

确保您正在使用bundle exec(很可能有多个capistrano的gem版本)

i.e.

即。

bundle exec cap -T

包exec帽- t

#4


7  

Instead of downgrading to Capistrano 2 use the new configuration from the current version.

不要降级到Capistrano 2,使用当前版本的新配置。

require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"

See also this nice posting, which summarises the differences between Capistrano 2 and 3.

你也可以看看这篇不错的文章,它总结了Capistrano 2和3的不同之处。

#5


4  

Add the related gems to your Gemfile

将相关的宝石添加到Gemfile中

i.e. for

例如

gem 'capistrano-bundler' # for capistrano/bundler
gem 'capistrano-rails' # for capistrano/rails/*

Do not downgrade to 2.x for this.

不要降级为2。x。

#6


2  

I had this problem today and pastullo's solution above fixed it except that I had to run gem uninstall capistrano (as markhorrocks answered) not bundle uninstall capistrano.

我今天遇到了这个问题,帕斯图洛的解决方案解决了这个问题,除了我必须运行gem卸载capistrano(正如markhorrocks所回答的)而不是捆绑卸载capistrano。

I also found this blog on bundler very useful: http://viget.com/extend/bundler-best-practices

我还发现bundler的博客非常有用:http://viget.com/extend/bundler-最佳实践

Thanks for sharing this as it saved me heaps of time. x

谢谢分享,因为它节省了我很多时间。x

#7


2  

The fastest way to fix this I have found is to backup the cap files (Capfile, config/deploy.rb, and config/deploy/*.rb) and then re capify (it's no longer called "capify"):

解决这个问题的最快方法是备份cap文件(Capfile, config/deploy)。rb,配置/部署/*.rb),然后重新进行capify(不再称为capify):

bundle exec cap install STAGES=staging,production

Then recreate your cap files from your backup. It will take you 5 minutes to do this and you'll be over the major Capistrano upgrade hump.

然后从备份中重新创建cap文件。你要花5分钟来完成这个任务,你将会越过卡皮斯特拉诺升级峰。

#8


0  

I used

我使用

bundle exec cap production deploy

bundle exec cap生产部署

instead of just cap production deploy

而不仅仅是限制生产部署

#9


0  

in my case I have changed my project ruby version. may be bundle also work here.

在我的情况下,我已经更改了我的项目ruby版本。也可能是捆绑在这里工作。

but I changed it to back what it was in previously.

但我把它改成了原来的样子。

ex:

例:

rbenv local 2.4.1