部署后缺少宝石(Ruby,Ruby on Rails,Capistrano)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了部署后缺少宝石(Ruby,Ruby on Rails,Capistrano)相关的知识,希望对你有一定的参考价值。

我正在创建一个Rails应用程序。我通过Capistrano部署到vps服务器,运行以下部署命令:

$ bundle exec cap development deploy

部署看似成功,但有些宝石丢失了。

The following gems are missing
 DEBUG [16b13d82]        * debug_inspector (0.0.3)
 * web-console (3.1.1)
 DEBUG [16b13d82]        * spring (1.7.2)
 * spring-watcher-listen (2.0.0)
 DEBUG [16b13d82]        * rails-controller-testing (0.1.1)
 DEBUG [16b13d82]        * ansi (1.5.0)
 DEBUG [16b13d82]        * ruby-progressbar (1.8.1)
 * minitest-reporters (1.1.9)
 * formatador (0.2.5)
 DEBUG [16b13d82]        * lumberjack (1.0.12)
 DEBUG [16b13d82]        * nenv (0.3.0)
 DEBUG [16b13d82]        * shellany (0.0.1)
 DEBUG [16b13d82]        * notiffany (0.1.1)
 DEBUG [16b13d82]        * coderay (1.1.1)
 DEBUG [16b13d82]        * slop (3.6.0)
 DEBUG [16b13d82]        * pry (0.10.4)
 DEBUG [16b13d82]        * guard (2.13.0)
 DEBUG [16b13d82]        * guard-compat (1.2.1)
 DEBUG [16b13d82]        * guard-minitest (2.4.4)
 DEBUG [16b13d82]       Install missing gems with `bundle install`

我想安装丢失的宝石。

规格是:

  • ubuntu 16.04
  • Bundler 1.14.6
  • ruby 2.4.1p111(2017-03-22 revision58053)[x86_64-darwin16]
  • Rails 5.1.2
  • 卡皮斯特拉诺3
  • cloud9(本地环境)

我的Gemfile:

source 'https://rubygems.org'

gem 'rails',  '5.1.2'
gem 'will_paginate',           '3.1.0'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'bootstrap-sass', '~> 3.3.6' 
gem 'sass-rails', '>= 3.2'
gem 'puma',         '3.4.0'
gem 'uglifier',     '3.0.0'
gem 'coffee-rails', '4.2.1'
gem 'jquery-rails', '4.1.1'
gem 'turbolinks',   '5.0.1'
gem 'jbuilder',     '2.4.1'
gem 'devise'
gem 'toastr-rails'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-google-oauth2'
gem 'paperclip'
gem 'geocoder'
gem 'jquery-ui-rails', '5.0.5'
gem 'private_pub'
gem 'thin'
gem 'ransack'
gem 'font-awesome-rails'
gem 'font-awesome-sass'
gem 'rails-i18n'
gem 'payjp'
gem 'carrierwave'
gem 'rmagick'
gem 'rack-mini-profiler'
gem 'rb-readline'
gem 'unicorn'
gem 'capistrano', '~> 3.6'
gem 'capistrano-rails', '~> 1.3'
gem 'capistrano-bundler'
gem 'capistrano-passenger'
gem 'capistrano-rbenv'
gem 'therubyracer',  platforms: :ruby
gem 'capistrano3-unicorn'
gem 'capistrano-safe-deploy-to'
gem 'listen', '~> 3.1.5'
gem 'sqlite3', '1.3.13'

group :development do
  gem 'web-console',           '3.1.1'
  gem 'spring',                '1.7.2'
  gem 'spring-watcher-listen', '2.0.0'
end

group :test do
  gem 'rails-controller-testing', '0.1.1'
  gem 'minitest-reporters',       '1.1.9'
  gem 'guard',                    '2.13.0'
  gem 'guard-minitest',           '2.4.4'
end

group :production do
  gem 'pg', '0.18.4'
  gem 'rails_12factor'
end

我的Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.0.3)
      actionpack (= 5.0.3)
      nio4r (>= 1.2, < 3.0)
      websocket-driver (~> 0.6.1)
    actionmailer (5.0.3)
      actionpack (= 5.0.3)
      actionview (= 5.0.3)
      activejob (= 5.0.3)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.0.3)
      actionview (= 5.0.3)
      activesupport (= 5.0.3)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.0.3)
      activesupport (= 5.0.3)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.0.3)
      activesupport (= 5.0.3)
      globalid (>= 0.3.6)
    activemodel (5.0.3)
      activesupport (= 5.0.3)
    activerecord (5.0.3)
      activemodel (= 5.0.3)
      activesupport (= 5.0.3)
      arel (~> 7.0)
    activesupport (5.0.3)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.5.1)
      public_suffix (~> 2.0, >= 2.0.2)
    airbrussh (1.3.0)
      sshkit (>= 1.6.1, != 1.7.0)
    ansi (1.5.0)
    arel (7.1.4)
    autoprefixer-rails (7.1.2.2)
      execjs
    bcrypt (3.1.11)
    bootstrap-sass (3.3.7)
      autoprefixer-rails (>= 5.2.1)
      sass (>= 3.3.4)
    bootstrap-will_paginate (0.0.10)
      will_paginate
    builder (3.2.3)
    capistrano (3.8.2)
      airbrussh (>= 1.0.0)
      i18n
      rake (>= 10.0.0)
      sshkit (>= 1.9.0)
    capistrano-bundler (1.2.0)
      capistrano (~> 3.1)
      sshkit (~> 1.2)
    capistrano-passenger (0.2.0)
      capistrano (~> 3.0)
    capistrano-rails (1.3.0)
      capistrano (~> 3.1)
      capistrano-bundler (~> 1.1)
    capistrano-rbenv (2.1.1)
      capistrano (~> 3.1)
      sshkit (~> 1.3)
    capistrano-safe-deploy-to (1.1.1)
      capistrano (>= 3.0)
    capistrano3-unicorn (0.2.1)
      capistrano (~> 3.1, >= 3.1.0)
    carrierwave (1.1.0)
      activemodel (>= 4.0.0)
      activesupport (>= 4.0.0)
      mime-types (>= 1.16)
    climate_control (0.2.0)
    cocaine (0.5.8)
      climate_control (>= 0.0.3, < 1.0)
    coderay (1.1.1)
    coffee-rails (4.2.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.2.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.0.5)
    cookiejar (0.3.3)
    daemons (1.2.4)
    debug_inspector (0.0.3)
    devise (4.3.0)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0, < 5.2)
      responders
      warden (~> 1.2.3)
    domain_name (0.5.20170404)
      unf (>= 0.0.5, < 1.0.0)
    em-http-request (1.1.5)
      addressable (>= 2.3.4)
      cookiejar (!= 0.3.1)
      em-socksify (>= 0.3)
      eventmachine (>= 1.0.3)
      http_parser.rb (>= 0.6.0)
    em-socksify (0.3.1)
      eventmachine (>= 1.0.0.beta.4)
    erubis (2.7.0)
    eventmachine (1.2.3)
    execjs (2.7.0)
    faraday (0.12.1)
      multipart-post (>= 1.2, < 3)
    faye (1.2.4)
      cookiejar (>= 0.3.0)
      em-http-request (>= 0.3.0)
      eventmachine (>= 0.12.0)
      faye-websocket (>= 0.9.1)
      multi_json (>= 1.0.0)
      rack (>= 1.0.0)
      websocket-driver (>= 0.5.1)
    faye-websocket (0.10.7)
      eventmachine (>= 0.12.0)
      websocket-driver (>= 0.5.1)
    ffi (1.9.18)
    font-awesome-rails (4.7.0.2)
      railties (>= 3.2, < 5.2)
    font-awesome-sass (4.7.0)
      sass (>= 3.2)
    formatador (0.2.5)
    geocoder (1.4.4)
    globalid (0.4.0)
      activesupport (>= 4.2.0)
    guard (2.13.0)
      formatador (>= 0.2.4)
      listen (>= 2.7, <= 4.0)
      lumberjack (~> 1.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-compat (1.2.1)
    guard-minitest (2.4.4)
      guard-compat (~> 1.2)
      minitest (>= 3.0)
    hashie (3.5.6)
    http-cookie (1.0.3)
      domain_name (~> 0.5)
    http_parser.rb (0.6.0)
    i18n (0.8.6)
    jbuilder (2.4.1)
      activesupport (>= 3.0.0, < 5.1)
      multi_json (~> 1.2)
    jquery-rails (4.1.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (5.0.5)
      railties (>= 3.2.16)
    jwt (1.5.6)
    kgio (2.11.0)
    libv8 (3.16.14.19)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    lumberjack (1.0.12)
    mail (2.6.6)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mimemagic (0.3.2)
    mini_portile2 (2.2.0)
    minitest (5.10.2)
    minitest-reporters (1.1.9)
      ansi
      builder
      minitest (>= 5.0)
      ruby-progressbar
    multi_json (1.12.1)
    multi_xml (0.6.0)
    multipart-post (2.0.0)
    nenv (0.3.0)
    net-scp (1.2.1)
      net-ssh (>= 2.6.5)
    net-ssh (4.1.0)
    netrc (0.11.0)
    nio4r (2.1.0)
    nokogiri (1.8.0)
      mini_portile2 (~> 2.2.0)
    notiffany (0.1.1)
      nenv (~> 0.1)
      shellany (~> 0.0)
    oauth (0.5.3)
    oauth2 (1.4.0)
      faraday (>= 0.8, < 0.13)
      jwt (~> 1.0)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (>= 1.2, < 3)
    omniauth (1.6.1)
      hashie (>= 3.4.6, < 3.6.0)
      rack (>= 1.6.2, < 3)
    omniauth-facebook (4.0.0)
      omniauth-oauth2 (~> 1.2)
    omniauth-google-oauth2 (0.5.0)
      jwt (~> 1.5)
      multi_json (~> 1.3)
      omniauth (>= 1.1.1)
      omniauth-oauth2 (>= 1.3.1)
    omniauth-oauth (1.1.0)
      oauth
      omniauth (~> 1.0)
    omniauth-oauth2 (1.4.0)
      oauth2 (~> 1.0)
      omniauth (~> 1.2)
    omniauth-twitter (1.4.0)
      omniauth-oauth (~> 1.1)
      rack
    orm_adapter (0.5.0)
    paperclip (5.1.0)
      activemodel (>= 4.2.0)
      activesupport (>= 4.2.0)
      cocaine (~> 0.5.5)
      mime-types
      mimemagic (~> 0.3.0)
    payjp (0.0.5)
      rest-client (~> 2.0)
    pg (0.18.4)
    polyamorous (1.3.1)
      activerecord (>= 3.0)
    private_pub (1.0.3)
      faye
    pry (0.10.4)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    public_suffix (2.0.5)
    puma (3.4.0)
    rack (2.0.3)
    rack-mini-profiler (0.10.5)
      rack (>= 1.2.0)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (5.0.3)
      actioncable (= 5.0.3)
      actionmailer (= 5.0.3)
      actionpack (= 5.0.3)
      actionview (= 5.0.3)
      activejob (= 5.0.3)
      activemodel (= 5.0.3)
      activerecord (= 5.0.3)
      activesupport (= 5.0.3)
      bundler (>= 1.3.0, < 2.0)
      railties (= 5.0.3)
      sprockets-rails (>= 2.0.0)
    rails-controller-testing (0.1.1)
      actionpack (~> 5.x)
      actionview (~> 5.x)
      activesupport (~> 5.x)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    rails-i18n (5.0.4)
      i18n (~> 0.7)
      railties (~> 5.0)
    rails_12factor (0.0.3)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.5)
    rails_stdout_logging (0.0.5)
    railties (5.0.3)
      actionpack (= 5.0.3)
      activesupport (= 5.0.3)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    raindrops (0.18.0)
    rake (12.0.0)
    ransack (1.8.3)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      activesupport (>= 3.0)
      i18n
      polyamorous (~> 1.3)
    rb-fsevent (0.10.2)
    rb-inotify (0.9.10)
      ffi (>= 0.5.0, < 2)
    rb-readline (0.5.4)
    ref (2.0.0)
    responders (2.4.0)
      actionpack (>= 4.2.0, < 5.3)
      railties (>= 4.2.0, < 5.3)
    rest-client (2.0.2)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 4.0)
      netrc (~> 0.8)
    rmagick (2.16.0)
    ruby-progressbar (1.8.1)
    ruby_dep (1.5.0)
    sass (3.5.1)
      sass-listen (~> 4.0.0)
    sass-listen (4.0.0)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    shellany (0.0.1)
    slop (3.6.0)
    spring (1.7.2)
    spring-watcher-listen (2.0.0)
      listen (>= 2.7, < 4.0)
      spring (~> 1.2)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.3.13)
    sshkit (1.14.0)
      net-scp (>= 1.1.2)
      net-ssh (>= 2.8.0)
    therubyracer (0.12.3)
      libv8 (~> 3.16.14.15)
      ref
    thin (1.7.2)
      daemons (~> 1.0, >= 1.0.9)
      eventmachine (~> 1.0, >= 1.0.4)
      rack (>= 1, < 3)
    thor (0.19.4)
    thread_safe (0.3.6)
    tilt (2.0.7)
    toastr-rails (1.0.3)
      railties (>= 3.1.0)
    turbolinks (5.0.1)
      turbolinks-source (~> 5)
    turbolinks-source (5.0.3)
    tzinfo (1.2.3)
      thread_safe (~> 0.1)
    uglifier (3.0.0)
      execjs (>= 0.3.0, < 3)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.4)
    unicorn (5.3.0)
      kgio (~> 2.6)
      raindrops (~> 0.7)
    warden (1.2.7)
      rack (>= 1.0)
    web-console (3.1.1)
      activemodel (>= 4.2)
      debug_inspector
      railties (>= 4.2)
    websocket-driver (0.6.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)
    will_paginate (3.1.0)

PLATFORMS
  ruby

DEPENDENCIES
  bootstrap-sass (~> 3.3.6)
  bootstrap-will_paginate (= 0.0.10)
  capistrano (~> 3.6)
  capistrano-bundler
  capistrano-passenger
  capistrano-rails (~> 1.3)
  capistrano-rbenv
  capistrano-safe-deploy-to
  capistrano3-unicorn
  carrierwave
  coffee-rails (= 4.2.1)
  devise
  font-awesome-rails
  font-awesome-sass
  geocoder
  guard (= 2.13.0)
  guard-minitest (= 2.4.4)
  jbuilder (= 2.4.1)
  jquery-rails (= 4.1.1)
  jquery-ui-rails (= 5.0.5)
  listen (~> 3.1.5)
  minitest-reporters (= 1.1.9)
  omniauth
  omniauth-facebook
  omniauth-google-oauth2
  omniauth-twitter
  paperclip
  payjp
  pg (= 0.18.4)
  private_pub
  puma (= 3.4.0)
  rack-mini-profiler
  rails (= 5.0.3)
  rails-controller-testing (= 0.1.1)
  rails-i18n
  rails_12factor
  ransack
  rb-readline
  rmagick
  sass-rails (>= 3.2)
  spring (= 1.7.2)
  spring-watcher-listen (= 2.0.0)
  sqlite3 (= 1.3.13)
  therubyracer
  thin
  toastr-rails
  turbolinks (= 5.0.1)
  uglifier (= 3.0.0)
  unicorn
  web-console (= 3.1.1)
  will_paginate (= 3.1.0)

BUNDLED WITH
   1.15.1

我的Capfile

require 'capistrano/setup'
require 'capistrano/deploy'
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
require 'capistrano/rbenv'
set :rbenv_type, :user
set :rbenv_ruby, '2.4.1'
require 'capistrano/bundler'
require 'capistrano3/unicorn'
require 'capistrano/rails'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/safe_deploy_to'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
答案

报告为缺失的宝石都是来自开发和测试组的宝石。所有其他宝石都在那里。

另一答案

您可以检查capistrano bundler,因为在生产服务器中这不是您开发中的Gem文件,您还应该在生产中安装gemfiles,因为您使用capistrano进行部署,那么您必须包含在您的Capfile中

require 'capistrano/bundler'

使用此命令,Capistrano将在部署期间在生产服务器中运行bundle install。

另一答案

我认为没有什么可以安装的。

capistrano-bundler首先检查是否有任何宝石丢失。这就是为什么你看到“以下宝石丢失”的消息。然后它会自动继续安装那些丢失的宝石。

如果再次部署,则不应看到“丢失”消息,因为现在已安装所有gem。

以上是关于部署后缺少宝石(Ruby,Ruby on Rails,Capistrano)的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Ruby on Rails 中裁剪图像

Ruby on Rails - Heroku上的Carrierwave错误

禁用 ruby​​ on rails 作业进行测试

Ruby on Rails 部署到阿里巴巴 ECS 后无法加载

Ruby on Rails 上的免费融合图表

旧宝石总是在更新版本的ruby上工作吗?