由于 mimemagic,Capistrano 部署失败

时间:2021-03-25 23:43:48

标签: ruby-on-rails ruby rubygems capistrano

我目前正在学习使用 capistrano 部署 ruby​​ rails。

我正在尝试在我的服务器上部署带有 capistrano 的 ruby​​ on rails 应用程序。该应用程序使用 postgres。服务器是 debian 上的 vps。我正在使用 ruby​​ 2.7.2

当我运行 bundle exec cap production deploy

它工作正常,直到捆绑安装步骤,然后我得到:

** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:


  INFO [b0d8548e] Finished in 5.718 seconds with exit status 0 (successful).

 DEBUG [5b5f514a] Running if test ! -d /home/roger/my-website.org/releases/20210325230506; then echo "Directory does not exist '/home/roger/my-website.org/releases/20210325230506'" 1>&2; false; fi as root@my-website.org

 DEBUG [5b5f514a] Command: if test ! -d /home/roger/my-website.org/releases/20210325230506; then echo "Directory does not exist '/home/roger/my-website.org/releases/20210325230506'" 1>&2; false; fi

 DEBUG [5b5f514a] Finished in 0.223 seconds with exit status 0 (successful).

 DEBUG [0988c64c] Running /home/roger/my-website.org/rvm1scripts/rvm-auto.sh . /usr/local/rvm/bin/rvm default do bundle check as root@my-website.org

 DEBUG [0988c64c] Command: cd /home/roger/my-website.org/releases/20210325230506 && /home/roger/my-website.org/rvm1scripts/rvm-auto.sh . /usr/local/rvm/bin/rvm default do bundle check

 DEBUG [0988c64c]       Your Gemfile lists the gem hashie-forbidden_attributes (>= 0) more than once.

You should probably keep only one of them.

Remove any duplicate entries and specify the gem only once.

While it's not a problem now, it could cause errors if you change the version of one of them later.

 DEBUG [0988c64c]       https://github.com/activeadmin/inherited_resources.git (at master@80bbdc3) is

not yet checked out. Run `bundle install` first.

 DEBUG [0988c64c] Finished in 6.042 seconds with exit status 11 (failed).

  INFO [a5e6399b] Running /home/roger/my-website.org/rvm1scripts/rvm-auto.sh . /usr/local/rvm/bin/rvm default do bundle install --jobs 4 --quiet as root@my-website.org

 DEBUG [a5e6399b] Command: cd /home/roger/my-website.org/releases/20210325230506 && /home/roger/my-website.org/rvm1scripts/rvm-auto.sh . /usr/local/rvm/bin/rvm default do bundle install --jobs 4 --quiet

 DEBUG [a5e6399b]       Your bundle is locked to mimemagic (0.3.6), but that version could not be found

in any of the sources listed in your Gemfile. If you haven't changed sources,

that means the author of mimemagic (0.3.6) has removed it. You'll need to update

your bundle to a version other than mimemagic (0.3.6) that hasn't been removed

in order to install

看起来这个版本的 mimemagic 已经不可用了。 所以我直接在 gemfile 中移动了 mimemagic 版本号。 (它不是很酷,但我没有直接使用 mimemagic,我希望使用不正确版本的 mimemagic 的 gem 可以很快更新) 我刚刚收到另一个错误:

** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:


 DEBUG [b5296d44] Command: cd /home/roger/my-website.org/releases/20210325231138 && /home/roger/my-website.org/rvm1scripts/rvm-auto.sh . /usr/local/rvm/bin/rvm default do bundle config --local without development:test

  INFO [b5296d44] Finished in 6.180 seconds with exit status 0 (successful).

 DEBUG [2112f82b] Running if test ! -d /home/roger/my-website.org/releases/20210325231138; then echo "Directory does not exist '/home/roger/my-website.org/releases/20210325231138'" 1>&2; false; fi as root@my-website.org

 DEBUG [2112f82b] Command: if test ! -d /home/roger/my-website.org/releases/20210325231138; then echo "Directory does not exist '/home/roger/my-website.org/releases/20210325231138'" 1>&2; false; fi

 DEBUG [2112f82b] Finished in 0.230 seconds with exit status 0 (successful).

 DEBUG [011e44ad] Running /home/roger/my-website.org/rvm1scripts/rvm-auto.sh . /usr/local/rvm/bin/rvm default do bundle check as root@my-website.org

 DEBUG [011e44ad] Command: cd /home/roger/my-website.org/releases/20210325231138 && /home/roger/my-website.org/rvm1scripts/rvm-auto.sh . /usr/local/rvm/bin/rvm default do bundle check

 DEBUG [011e44ad]       Your Gemfile lists the gem hashie-forbidden_attributes (>= 0) more than once.

You should probably keep only one of them.

Remove any duplicate entries and specify the gem only once.

While it's not a problem now, it could cause errors if you change the version of one of them later.

 DEBUG [011e44ad]       https://github.com/activeadmin/inherited_resources.git (at master@80bbdc3) is

not yet checked out. Run `bundle install` first.

 DEBUG [011e44ad] Finished in 6.064 seconds with exit status 11 (failed).

  INFO [539a9888] Running /home/roger/my-website.org/rvm1scripts/rvm-auto.sh . /usr/local/rvm/bin/rvm default do bundle install --jobs 4 --quiet as root@my-website.org

 DEBUG [539a9888] Command: cd /home/roger/my-website.org/releases/20210325231138 && /home/roger/my-website.org/rvm1scripts/rvm-auto.sh . /usr/local/rvm/bin/rvm default do bundle install --jobs 4 --quiet

 DEBUG [539a9888]       Downloading mimemagic-0.4.2 revealed dependencies not in the API or the lockfile

(nokogiri (~> 1), rake (>= 0)).

Either installing with `--full-index` or running `bundle update mimemagic`

should fix the problem. 

它建议我运行 bundle update mimemagic 来解决问题。 但我知道如何在本地运行它,我知道如何在我的服务器上运行......但不知道如何在 capistrano 部署过程中具体运行。

有人对我可以尝试解决这个问题的方法有什么想法吗? 谢谢

编辑:我尝试将 gemlock 移至 mimemagic 0.3.9,但在运行 bundle exec cap production deploy

时收到此错误消息
An error occurred while installing mimemagic (0.3.9), and Bundler cannot

continue.

Make sure that `gem install mimemagic -v '0.3.9' --source

'https://rubygems.org/'` succeeds before bundling.



In Gemfile:

  grape_on_rails_routes was resolved to 0.3.2, which depends on

    rails was resolved to 6.0.0, which depends on

      actionmailbox was resolved to 6.0.0, which depends on

        activestorage was resolved to 6.0.0, which depends on

          marcel was resolved to 0.3.3, which depends on

            mimemagic

ps:我的 gemfile:

source 'https://rubygems.org'
ruby '2.7.2'

gem 'bootsnap', require: false
gem 'devise'
gem 'ed25519'
gem 'bcrypt_pbkdf'
gem 'jbuilder', '~> 2.0'
gem 'pg', '~> 0.21'
gem 'puma'
gem 'rails', '6.0.0'
gem 'redis'
gem 'grape'
gem 'gon'
gem 'cookies_eu'
gem 'grape-entity'
gem 'grape_on_rails_routes'
gem 'hashie-forbidden_attributes'

gem 'autoprefixer-rails'
gem 'font-awesome-sass', '~> 5.6.1'
gem 'sassc-rails'
gem 'simple_form'
gem 'uglifier'
gem 'webpacker'
gem 'kaminari'   #gem qui permet de gerer un affichage sur plusieurs pages d'une liste
gem 'cloudinary', '~> 1.9.1' #pour uploader et retoucher simplement des photos
gem 'carrierwave', '~> 1.2' # c'est la gem qui associe une photo ou un fichier uploadé a un modéle
gem 'activeadmin', github: 'activeadmin/activeadmin'
gem 'inherited_resources', github: 'activeadmin/inherited_resources'
gem 'money-rails'
gem 'stripe'
gem 'stripe_event'
gem 'hashie-forbidden_attributes'

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'capistrano'
  gem 'capistrano-rails'
  gem 'capistrano-rvm'
  gem 'capistrano-bundler', require: false
  gem 'capistrano3-puma', github: "seuros/capistrano-puma"
  gem 'rvm1-capistrano3', require: false


end

group :development, :test do
  gem 'pry-byebug'
  gem 'rspec-rails', '~> 4.0.2'
  gem 'pry-rails'
  gem 'listen', '~> 3.0.5'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  gem 'dotenv-rails'

end

我的宝石:

GIT
  remote: https://github.com/activeadmin/activeadmin.git
  revision: d1296678b9efdfd31cf56b98a0c8e7d7a3260ad5
  specs:
    activeadmin (2.9.0)
      arbre (~> 1.2, >= 1.2.1)
      formtastic (>= 3.1, < 5.0)
      formtastic_i18n (~> 0.4)
      inherited_resources (~> 1.7)
      jquery-rails (~> 4.2)
      kaminari (~> 1.0, >= 1.2.1)
      railties (>= 5.2, < 6.2)
      ransack (~> 2.1, >= 2.1.1)

GIT
  remote: https://github.com/activeadmin/inherited_resources.git
  revision: 80bbdc309ad5cf69c84710f27df485b212a21d4a
  specs:
    inherited_resources (1.12.0)
      actionpack (>= 5.2, < 6.2)
      has_scope (~> 0.6)
      railties (>= 5.2, < 6.2)
      responders (>= 2, < 4)

GIT
  remote: https://github.com/seuros/capistrano-puma.git
  revision: 186826736ac83c550fd6129728284584b8c9c782
  specs:
    capistrano3-puma (5.0.4)
      capistrano (~> 3.7)
      capistrano-bundler
      puma (>= 4.0, < 6.0)

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (6.0.0)
      actionpack (= 6.0.0)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (6.0.0)
      actionpack (= 6.0.0)
      activejob (= 6.0.0)
      activerecord (= 6.0.0)
      activestorage (= 6.0.0)
      activesupport (= 6.0.0)
      mail (>= 2.7.1)
    actionmailer (6.0.0)
      actionpack (= 6.0.0)
      actionview (= 6.0.0)
      activejob (= 6.0.0)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (6.0.0)
      actionview (= 6.0.0)
      activesupport (= 6.0.0)
      rack (~> 2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (6.0.0)
      actionpack (= 6.0.0)
      activerecord (= 6.0.0)
      activestorage (= 6.0.0)
      activesupport (= 6.0.0)
      nokogiri (>= 1.8.5)
    actionview (6.0.0)
      activesupport (= 6.0.0)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activejob (6.0.0)
      activesupport (= 6.0.0)
      globalid (>= 0.3.6)
    activemodel (6.0.0)
      activesupport (= 6.0.0)
    activerecord (6.0.0)
      activemodel (= 6.0.0)
      activesupport (= 6.0.0)
    activestorage (6.0.0)
      actionpack (= 6.0.0)
      activejob (= 6.0.0)
      activerecord (= 6.0.0)
      marcel (~> 0.3.1)
    activesupport (6.0.0)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
      zeitwerk (~> 2.1, >= 2.1.8)
    airbrussh (1.4.0)
      sshkit (>= 1.6.1, != 1.7.0)
    arbre (1.4.0)
      activesupport (>= 3.0.0, < 6.2)
      ruby2_keywords (>= 0.0.2, < 1.0)
    autoprefixer-rails (10.2.4.0)
      execjs
    aws_cf_signer (0.1.3)
    bcrypt (3.1.16)
    bcrypt_pbkdf (1.1.0)
    bindex (0.8.1)
    bootsnap (1.7.3)
      msgpack (~> 1.0)
    builder (3.2.4)
    byebug (11.1.3)
    capistrano (3.16.0)
      airbrussh (>= 1.0.0)
      i18n
      rake (>= 10.0.0)
      sshkit (>= 1.9.0)
    capistrano-bundler (2.0.1)
      capistrano (~> 3.1)
    capistrano-rails (1.6.1)
      capistrano (~> 3.1)
      capistrano-bundler (>= 1.1, < 3)
    capistrano-rvm (0.1.2)
      capistrano (~> 3.0)
      sshkit (~> 1.2)
    carrierwave (1.3.2)
      activemodel (>= 4.0.0)
      activesupport (>= 4.0.0)
      mime-types (>= 1.16)
      ssrf_filter (~> 1.0)
    cloudinary (1.9.1)
      aws_cf_signer
      rest-client
    coderay (1.1.3)
    concurrent-ruby (1.1.8)
    cookies_eu (1.7.7)
      js_cookie_rails (~> 2.2.0)
    crass (1.0.6)
    devise (4.7.3)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0)
      responders
      warden (~> 1.2.3)
    diff-lcs (1.4.4)
    domain_name (0.5.20190701)
      unf (>= 0.0.5, < 1.0.0)
    dotenv (2.7.6)
    dotenv-rails (2.7.6)
      dotenv (= 2.7.6)
      railties (>= 3.2)
    dry-configurable (0.12.1)
      concurrent-ruby (~> 1.0)
      dry-core (~> 0.5, >= 0.5.0)
    dry-container (0.7.2)
      concurrent-ruby (~> 1.0)
      dry-configurable (~> 0.1, >= 0.1.3)
    dry-core (0.5.0)
      concurrent-ruby (~> 1.0)
    dry-inflector (0.2.0)
    dry-logic (1.1.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 0.5, >= 0.5)
    dry-types (1.5.1)
      concurrent-ruby (~> 1.0)
      dry-container (~> 0.3)
      dry-core (~> 0.5, >= 0.5)
      dry-inflector (~> 0.1, >= 0.1.2)
      dry-logic (~> 1.0, >= 1.0.2)
    ed25519 (1.2.4)
    erubi (1.10.0)
    execjs (2.7.0)
    ffi (1.15.0)
    font-awesome-sass (5.6.1)
      sassc (>= 1.11)
    formtastic (4.0.0)
      actionpack (>= 5.2.0)
    formtastic_i18n (0.6.0)
    globalid (0.4.2)
      activesupport (>= 4.2.0)
    gon (6.4.0)
      actionpack (>= 3.0.20)
      i18n (>= 0.7)
      multi_json
      request_store (>= 1.0)
    grape (1.5.3)
      activesupport
      builder
      dry-types (>= 1.1)
      mustermann-grape (~> 1.0.0)
      rack (>= 1.3.0)
      rack-accept
    grape-entity (0.9.0)
      activesupport (>= 3.0.0)
      multi_json (>= 1.3.2)
    grape_on_rails_routes (0.3.2)
      rails (>= 3.1.1)
    has_scope (0.8.0)
      actionpack (>= 5.2)
      activesupport (>= 5.2)
    hashie (4.1.0)
    hashie-forbidden_attributes (0.1.1)
      hashie (>= 3.0)
    http-accept (1.7.0)
    http-cookie (1.0.3)
      domain_name (~> 0.5)
    i18n (1.8.9)
      concurrent-ruby (~> 1.0)
    jbuilder (2.11.2)
      activesupport (>= 5.0.0)
    jquery-rails (4.4.0)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    js_cookie_rails (2.2.0)
      railties (>= 3.1)
    kaminari (1.2.1)
      activesupport (>= 4.1.0)
      kaminari-actionview (= 1.2.1)
      kaminari-activerecord (= 1.2.1)
      kaminari-core (= 1.2.1)
    kaminari-actionview (1.2.1)
      actionview
      kaminari-core (= 1.2.1)
    kaminari-activerecord (1.2.1)
      activerecord
      kaminari-core (= 1.2.1)
    kaminari-core (1.2.1)
    listen (3.0.8)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    loofah (2.9.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (0.3.3)
      mimemagic (= 0.3.9)
    method_source (1.0.0)
    mime-types (3.3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2021.0225)
    mimemagic (0.3.9)
      nokogiri (~> 1)
      rake
    mini_mime (1.0.2)
    mini_portile2 (2.5.0)
    minitest (5.14.4)
    monetize (1.9.4)
      money (~> 6.12)
    money (6.13.8)
      i18n (>= 0.6.4, <= 2)
    money-rails (1.14.0)
      activesupport (>= 3.0)
      monetize (~> 1.9.0)
      money (~> 6.13.2)
      railties (>= 3.0)
    msgpack (1.4.2)
    multi_json (1.15.0)
    mustermann (1.1.1)
      ruby2_keywords (~> 0.0.1)
    mustermann-grape (1.0.1)
      mustermann (>= 1.0.0)
    net-scp (3.0.0)
      net-ssh (>= 2.6.5, < 7.0.0)
    net-ssh (6.1.0)
    netrc (0.11.0)
    nio4r (2.5.7)
    nokogiri (1.11.2)
      mini_portile2 (~> 2.5.0)
      racc (~> 1.4)
    orm_adapter (0.5.0)
    pg (0.21.0)
    pry (0.13.1)
      coderay (~> 1.1)
      method_source (~> 1.0)
    pry-byebug (3.9.0)
      byebug (~> 11.0)
      pry (~> 0.13.0)
    pry-rails (0.3.9)
      pry (>= 0.10.4)
    puma (5.2.2)
      nio4r (~> 2.0)
    racc (1.5.2)
    rack (2.2.3)
    rack-accept (0.4.5)
      rack (>= 0.4)
    rack-proxy (0.6.5)
      rack
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails (6.0.0)
      actioncable (= 6.0.0)
      actionmailbox (= 6.0.0)
      actionmailer (= 6.0.0)
      actionpack (= 6.0.0)
      actiontext (= 6.0.0)
      actionview (= 6.0.0)
      activejob (= 6.0.0)
      activemodel (= 6.0.0)
      activerecord (= 6.0.0)
      activestorage (= 6.0.0)
      activesupport (= 6.0.0)
      bundler (>= 1.3.0)
      railties (= 6.0.0)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.3.0)
      loofah (~> 2.3)
    railties (6.0.0)
      actionpack (= 6.0.0)
      activesupport (= 6.0.0)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.20.3, < 2.0)
    rake (13.0.3)
    ransack (2.4.2)
      activerecord (>= 5.2.4)
      activesupport (>= 5.2.4)
      i18n
    rb-fsevent (0.10.4)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    redis (4.2.5)
    request_store (1.5.0)
      rack (>= 1.4)
    responders (3.0.1)
      actionpack (>= 5.0)
      railties (>= 5.0)
    rest-client (2.1.0)
      http-accept (>= 1.7.0, < 2.0)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 4.0)
      netrc (~> 0.8)
    rspec-core (3.10.1)
      rspec-support (~> 3.10.0)
    rspec-expectations (3.10.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.10.0)
    rspec-mocks (3.10.2)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.10.0)
    rspec-rails (4.0.2)
      actionpack (>= 4.2)
      activesupport (>= 4.2)
      railties (>= 4.2)
      rspec-core (~> 3.10)
      rspec-expectations (~> 3.10)
      rspec-mocks (~> 3.10)
      rspec-support (~> 3.10)
    rspec-support (3.10.2)
    ruby2_keywords (0.0.4)
    rvm1-capistrano3 (1.4.0)
      capistrano (~> 3.0)
      sshkit (>= 1.2)
    sassc (2.4.0)
      ffi (~> 1.9)
    sassc-rails (2.1.2)
      railties (>= 4.0.0)
      sassc (>= 2.0)
      sprockets (> 3.0)
      sprockets-rails
      tilt
    semantic_range (3.0.0)
    simple_form (5.1.0)
      actionpack (>= 5.2)
      activemodel (>= 5.2)
    spring (2.1.1)
    spring-watcher-listen (2.0.1)
      listen (>= 2.7, < 4.0)
      spring (>= 1.2, < 3.0)
    sprockets (4.0.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.2)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sshkit (1.21.2)
      net-scp (>= 1.1.2)
      net-ssh (>= 2.8.0)
    ssrf_filter (1.0.7)
    stripe (5.30.0)
    stripe_event (2.3.1)
      activesupport (>= 3.1)
      stripe (>= 2.8, < 6)
    thor (1.1.0)
    thread_safe (0.3.6)
    tilt (2.0.10)
    tzinfo (1.2.9)
      thread_safe (~> 0.1)
    uglifier (4.2.0)
      execjs (>= 0.3.0, < 3)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.7)
    warden (1.2.9)
      rack (>= 2.0.9)
    web-console (4.1.0)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    webpacker (5.2.1)
      activesupport (>= 5.2)
      rack-proxy (>= 0.6.1)
      railties (>= 5.2)
      semantic_range (>= 2.3.0)
    websocket-driver (0.7.3)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    zeitwerk (2.4.2)

PLATFORMS
  ruby

DEPENDENCIES
  activeadmin!
  autoprefixer-rails
  bcrypt_pbkdf
  bootsnap
  capistrano
  capistrano-bundler
  capistrano-rails
  capistrano-rvm
  capistrano3-puma!
  carrierwave (~> 1.2)
  cloudinary (~> 1.9.1)
  cookies_eu
  devise
  dotenv-rails
  ed25519
  font-awesome-sass (~> 5.6.1)
  gon
  grape
  grape-entity
  grape_on_rails_routes
  hashie-forbidden_attributes
  inherited_resources!
  jbuilder (~> 2.0)
  kaminari
  listen (~> 3.0.5)
  money-rails
  pg (~> 0.21)
  pry-byebug
  pry-rails
  puma
  rails (= 6.0.0)
  redis
  rspec-rails (~> 4.0.2)
  rvm1-capistrano3
  sassc-rails
  simple_form
  spring
  spring-watcher-listen (~> 2.0.0)
  stripe
  stripe_event
  uglifier
  web-console (>= 3.3.0)
  webpacker

RUBY VERSION
   ruby 2.7.2p137

BUNDLED WITH
   2.1.4

1 个答案:

答案 0 :(得分:2)

我使用 apt install shared-mime-info

解决了这个问题

在 Mac 上它的 brew install shared-mime-info

然后bundle update nokogiri marcel mimemagic

在我的服务器和我的开发计算机上使用它并稍微移动它的 mimemagic 版本之后。

我没有在另一个问题上运行。感谢您的帮助:-)

相关问题