0

我正在尝试通过 github 将 Rails 4 应用程序通过 Capistrano 2.15.5 部署到 Webfaction。最初我安装了 Capistrano 3 并且遇到了错误,所以我最终安装了 Capistrano 2.15.5 并在此处遵循 webfaction 的文档:

我与 webfaction 进行了交谈,他们建议我尝试旧的 Cap 2 版本,因为这是他们熟悉的版本,并且暂时不会更新 Capistrano 3 的文档。

我完成了他们教程中的所有适当步骤,并且在尝试运行“cap deploy:setup”或“cap deploy:check”等时遇到了一堆错误。

粘贴箱中的错误,此处:(如下所示)

/Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require': cannot load such file -- capistrano/setup (LoadError)
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require'
    from Capfile:6:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:180:in `load_from_file'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:89:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `block in load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `each'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `each'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `load_recipes'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:31:in `execute!'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>' 
galactica% cap deploy:check
/Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require': cannot load such file -- capistrano/setup (LoadError)
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require'
    from Capfile:6:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:180:in `load_from_file'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:89:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `block in load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `each'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `each'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `load_recipes'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:31:in `execute!'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'

我试过查看文件,但我不确定问题出在哪里,而且我不知道足够多的红宝石来解决问题。我希望你们能帮助我。

任何帮助将不胜感激和 gittipp'ed !:)

先感谢您!〜乔希

4

3 回答 3

3

我猜你是用 Capistrano 3 设置项目的配置,我认为 Capistrano 2 的设置是不同的。

我不太熟悉这些差异,但你得到的错误是cannot load such file -- capistrano/setup这篇关于 capistrano 3 引用require 'capistrano/setup'的帖子是在Capfilecapistrano 3 生成的。

所以我猜测 capistrano 2 不存在该文件。我不知道 capistrano 2 是否具有可以运行并让它们覆盖您拥有的文件的生成器,但如果有,请尝试一下?

或者尝试取出那条线,看看你是否得到不同的错误?或者恢复您开始设置 capistrano 3 的提交并使用 capistrano 2 完全重新开始配置过程?

于 2013-12-11T18:54:43.230 回答
0

您是否在 ruby​​ v2.0 下使用“gem install”安装了 Capistrano 2?

rvm 2.0.0 gem install capistrano“你的版本”

先试试这个......

于 2013-11-27T00:42:15.923 回答
0

我在使用 cap 2.15.5 部署我的 rails 4 应用程序时遇到了同样的错误。我进行了研究,发现问题出在语法上,因为我从 cap 3 切换到 cap 2。因此,如果您使用 cap v2,则仅 load 命令在 capfile 中工作,而 Require 命令仅在 deploy.rb 中使用。因此,如果您从 3 切换到 2,请记住语法,因为 cap v2 和 cap v3 之间有很多变化。

注意:对于部署 rails 4 应用程序 2.15.5 是您可以使用的稳定 capistrano 版本。这是对我有用的指南链接:https: //gist.github.com/brobertsaz/8660415

于 2014-01-31T11:49:25.803 回答