我正在使用安装了capistrano的ubuntu vagrant box来开发应用程序。 当我尝试部署时,我收到以下错误:
/usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:152:in `require': no such file to load -- capistrano/ext/multistage (LoadError)
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:152:in `require'
from ./config/deploy.rb:3:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:172:in `load_from_file'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from Capfile:4:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:172:in `load_from_file'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `load_recipes'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `load_recipes'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:31:in `execute!'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:14:in `execute'
from /usr/bin/cap:4
谷歌建议我尝试重新安装capistrano,但由于依赖性而失败(net-ssh需要ruby> = 2.0) 所以我安装了net-ssh v2.9.2
sudo gem install net-ssh -v 2.9.2
Fetching: net-ssh-2.9.2.gem (100%)
Successfully installed net-ssh-2.9.2
1 gem installed
但现在出现下一个依赖性错误... 如何使capistrano的全新安装工作? 我需要更新版本的ruby(apt-get install ruby告诉我已经安装了最新版本)? 或者这个错误的原因是完全不同的?
答案 0 :(得分:1)
我无法在您的跟踪中看到有关您所使用的红宝石版本的任何内容,但您确实说过" net-ssh需要ruby> = 2.0",所以你可能需要更新版本的红宝石,就像你说的那样。您可以使用ruby -v
检查您正在使用的ruby版本。我还建议使用版本管理器,以便您可以在项目之间使用多个版本。我发现RVM或rbenv是一个很好的起点。
答案 1 :(得分:0)
好的,这很奇怪......
运行vagrant provision多次(~5次)并安装/卸载多个gem和ruby版本后,下一个" vagrant provision"解决了魔术问题。我仍然不知道为什么会发生这个错误以及修正了什么,公牛我会关闭这个问题......