【问题标题】:Unable to activate capistrano-rails-1.2.3 , conflicts with capistrano无法激活 capistrano-rails-1.2.3 ,与 capistrano 冲突
【发布时间】:2017-09-28 04:49:07
【问题描述】:

我在下一篇关于 Deploy Ruby On Rails 的教程中遇到以下问题 Ubuntu 16.04:https://gorails.com/deploy/ubuntu/16.04

问题似乎出在 capistrano 上。

nicoara@ubuntu:~/deploy_test$ cap install STAGES=production
/home/nicoara/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/specification.rb:2112:in `raise_if_conflicts': Unable to activate capistrano-rails-1.2.3, because capistrano-2.15.9 conflicts with capistrano (~> 3.1) (Gem::ConflictError)
           from /home/nicoara/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/specification.rb:1280:in `activate'
           from /home/nicoara/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems.rb:198:in `rescue in try_activate'
           from /home/nicoara/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems.rb:195:in `try_activate'

...

我的 gemfile 有:

   group :development do
   gem 'capistrano', '~> 3.7', '>= 3.7.1'
   gem 'capistrano-rails', '~> 1.2'
   gem 'capistrano-passenger', '~> 0.2.0'
   gem 'capistrano-rbenv', '~> 2.1'

我的 capfile 有:

   # Capfile
   require 'capistrano/rails'
   require 'capistrano/passenger'

   # If you are using rbenv add these lines:
   require 'capistrano/rbenv'
   set :rbenv_type, :user
   set :rbenv_ruby, '2.4.0'

怎么办?

谢谢

【问题讨论】:

    标签: ruby-on-rails capistrano


    【解决方案1】:

    错误消息说:

    因为 capistrano-2.15.9 冲突

    显然 Capistrano 2.15.9 正在执行,即使您的 Gemfile 描述的意图是使用 capistrano 3.7。

    使用bundle exec cap 确保您运行的是 Gemfile 中指定的 Capistrano 版本。

    【讨论】:

    • 感谢您的回答。 nicoara@ubuntu:~/deploy_test$ bundle exec cap (Backtrace 仅限于导入的任务) cap 中止了! NoMethodError: undefined method stages' for Capistrano::DSL:Module /home/nicoara/deploy_test/Capfile:2:in require' /home/nicoara/deploy_test/Capfile:2:in `' (通过使用--trace运行任务查看完整跟踪)似乎是一个问题Capfile 开头为:# Capfile require "capistrano/rails" require "capistrano/passenger"
    • 您的 Capfile 不应以这些行开头。教程说要将这些行添加到 Capfile。不应删除 Capfile 的原始内容。确保这些东西在顶部:github.com/capistrano/capistrano/blob/…
    • 现在显示:“LoadError: cannot load such file -- capistrano/passenger”。我看到乘客没有出现在“宝石列表”中。
    • 对不起,根据您发布的内容,如果您使用的是bundle exec,我看不出这样的错误是怎么可能的。我没主意了。祝你好运!
    • 抱歉,不知何故在 gemfile 中缺少 gem 'capistrano-passenger', '~> 0.2.0'。现在 "bundle exec cap" 显示 "Stage not set, please call something like cap production deploy" 。现在 "cap production deploy" 或 "cap install STAGES=production" 都显示 " `require': cannot load such file -- capistrano/setup (LoadError) ",Capfile 的第一行。该怎么办?谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-07
    • 2019-06-21
    相关资源
    最近更新 更多