无法加载此类文件 – capistrano / setup(LoadError)

我关注https://gorails.com/deploy/ubuntu/16.04

最初我有一个版本的capistrano 3.8.1,我的问题最初是:

nicoara@ubuntu:~/deploy_test$ cap install STAGES=production /home/nicoara/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- capistrano/cli (LoadError) 

我用“gem install rvm-capistrano”来解决这个问题,它安装了另一个版本的capistrano,2.15.6,现在的错误是:

 nicoara@ubuntu:~/deploy_test$ cap install STAGES=production: `require': cannot load such file -- capistrano/setup (LoadError) 

在这一点上我无法解决。

正如评论所述,有几个步骤要遵循:

  1. 确保Gemfile中列出了所有capistrano/* gems。
  2. 运行bundle install以安装它们。
  3. 确保它们在你的Capfile中拼写正确(我已经多次搞砸了!)。
  4. 使用bundle exec添加cap命令是额外安全的,即STAGES=production bundle exec cap install