Corrupt Gemfile.lock Error with Capistrano

﹥>﹥吖頭↗ 提交于 2019-12-04 02:19:27

问题


I'm trying to deploy my app using Capistrano, but I'm getting this error:

Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES
section: 'nokogiri'

I saw this question, unfortunately, the solution (switching Bundler versions) didn't work for me: Travis reports odd message of corrupted Gemfile.lock

I have tried: deleting the gemfile.lock (and doing a bundle _1.10.6_ install), after adding nokogiri to my gemfile, but I still get the same error.

Here's my gemfile:

source 'http://rubygems.org' 

gem 'rails', '4.2.5'
gem 'mysql2', '0.4.2'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '4.0.5'
gem 'turbolinks', '2.5.3'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc

gem 'whenever', '0.9.4', :require => false
gem 'simple_form', '3.2.0' 
gem 'devise', '3.5.2' 
gem 'omniauth-facebook', '3.0.0' 
gem "cocoon", '1.2.6' 
gem "paperclip", "~> 4.3" 
gem 'braintree', '2.55.0'
gem 'figaro', '~> 0.7.0'
gem 'activeadmin', github: 'activeadmin' 
gem 'aws-sdk-v1', '1.66.0'
gem 'transloadit-rails', '1.1.2' 
gem 'ratyrate', '1.2.2.alpha' 
gem "mediaelement_rails", '0.8.2' 
gem 'will_paginate', '~> 3.0.6' 
gem 'will_paginate-bootstrap', '1.0.1' 
gem 'ransack', '1.7.0' 
gem 'jquery-turbolinks', '2.1.0' 
gem 'meta-tags', '2.1.0' 
gem 'sitemap_generator', '5.1.0' 
gem 'nokogiri'

My gemfile.lock:

GIT
  remote: git://github.com/activeadmin/activeadmin.git
  revision: ab1d8d1a4a1af748ae7009d9d725193d780d0059
  specs:
    activeadmin (1.0.0.pre2)
      arbre (~> 1.0, >= 1.0.2)
      bourbon
      coffee-rails
      formtastic (~> 3.1)
      formtastic_i18n
      inherited_resources (~> 1.6)
      jquery-rails
      jquery-ui-rails
      kaminari (~> 0.15)
      rails (>= 3.2, < 5.0)
      ransack (~> 1.3)
      sass-rails

GEM
  remote: http://rubygems.org/
  specs:
    actionmailer (4.2.5)
      actionpack (= 4.2.5)
      actionview (= 4.2.5)
      activejob (= 4.2.5)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.5)
      actionview (= 4.2.5)
      activesupport (= 4.2.5)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.5)
      activesupport (= 4.2.5)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.5)
      activesupport (= 4.2.5)
      globalid (>= 0.3.0)
    activemodel (4.2.5)
      activesupport (= 4.2.5)
      builder (~> 3.1)
    activerecord (4.2.5)
      activemodel (= 4.2.5)
      activesupport (= 4.2.5)
      arel (~> 6.0)
    activesupport (4.2.5)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    arbre (1.0.3)
      activesupport (>= 3.0.0)
    arel (6.0.3)
    aws-sdk-v1 (1.66.0)
      json (~> 1.4)
      nokogiri (>= 1.4.4)
    bcrypt (3.1.10-x86-mingw32)
    bourbon (3.2.4)
      sass (~> 3.2)
      thor
    braintree (2.55.0)
      builder (>= 2.0.0)
    builder (3.2.2)
    chronic (0.10.2)
    climate_control (0.0.3)
      activesupport (>= 3.0)
    cocaine (0.5.8)
      climate_control (>= 0.0.3, < 1.0)
    cocoon (1.2.6)
    coffee-rails (4.0.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    devise (3.5.2)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    domain_name (0.5.25)
      unf (>= 0.0.5, < 1.0.0)
    erubis (2.7.0)
    execjs (2.6.0)
    faraday (0.9.2)
      multipart-post (>= 1.2, < 3)
    ffi (1.9.10-x86-mingw32)
    figaro (0.7.0)
      bundler (~> 1.0)
      rails (>= 3, < 5)
    formtastic (3.1.3)
      actionpack (>= 3.2.13)
    formtastic_i18n (0.4.1)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    has_scope (0.6.0)
      actionpack (>= 3.2, < 5)
      activesupport (>= 3.2, < 5)
    hashie (3.4.3)
    hike (1.2.3)
    http-cookie (1.0.2)
      domain_name (~> 0.5)
    i18n (0.7.0)
    inherited_resources (1.6.0)
      actionpack (>= 3.2, < 5)
      has_scope (~> 0.6.0.rc)
      railties (>= 3.2, < 5)
      responders
    jbuilder (2.4.0)
      activesupport (>= 3.0.0, < 5.1)
      multi_json (~> 1.2)
    jquery-rails (4.0.5)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jquery-turbolinks (2.1.0)
      railties (>= 3.1.0)
      turbolinks
    jquery-ui-rails (5.0.5)
      railties (>= 3.2.16)
    json (1.8.3)
    jwt (1.5.2)
    kaminari (0.16.3)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    mediaelement_rails (0.8.2)
      jquery-rails (>= 1.0)
      railties (>= 3.1)
    meta-tags (2.1.0)
      actionpack (>= 3.0.0)
    mime-types (2.99)
    mimemagic (0.3.0)
    mini_portile2 (2.0.0)
    minitest (5.8.3)
    multi_json (1.11.2)
    multi_xml (0.5.5)
    multipart-post (2.0.0)
    mysql2 (0.4.2-x86-mingw32)
    netrc (0.11.0)
    nokogiri (1.6.7.1-x86-mingw32)
      mini_portile2 (~> 2.0.0.rc2)
    oauth2 (1.0.0)
      faraday (>= 0.8, < 0.10)
      jwt (~> 1.0)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (~> 1.2)
    omniauth (1.3.1)
      hashie (>= 1.2, < 4)
      rack (>= 1.0, < 3)
    omniauth-facebook (3.0.0)
      omniauth-oauth2 (~> 1.2)
    omniauth-oauth2 (1.4.0)
      oauth2 (~> 1.0)
      omniauth (~> 1.2)
    orm_adapter (0.5.0)
    paperclip (4.3.2)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      cocaine (~> 0.5.5)
      mime-types
      mimemagic (= 0.3.0)
    polyamorous (1.3.0)
      activerecord (>= 3.0)
    quiet_assets (1.1.0)
      railties (>= 3.1, < 5.0)
    rack (1.6.4)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.5)
      actionmailer (= 4.2.5)
      actionpack (= 4.2.5)
      actionview (= 4.2.5)
      activejob (= 4.2.5)
      activemodel (= 4.2.5)
      activerecord (= 4.2.5)
      activesupport (= 4.2.5)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.5)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.2)
      loofah (~> 2.0)
    railties (4.2.5)
      actionpack (= 4.2.5)
      activesupport (= 4.2.5)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.4.2)
    ransack (1.7.0)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      activesupport (>= 3.0)
      i18n
      polyamorous (~> 1.2)
    ratyrate (1.2.2.alpha)
    rdoc (4.2.1)
      json (~> 1.4)
    responders (2.1.1)
      railties (>= 4.2.0, < 5.1)
    rest-client (1.8.0-x86-mingw32)
      ffi (~> 1.9)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 3.0)
      netrc (~> 0.7)
    sass (3.2.19)
    sass-rails (4.0.5)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.2.2)
      sprockets (~> 2.8, < 3.0)
      sprockets-rails (~> 2.0)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    simple_form (3.2.0)
      actionpack (~> 4.0)
      activemodel (~> 4.0)
    sitemap_generator (5.1.0)
      builder
    sprockets (2.12.4)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.3.3)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (>= 2.8, < 4.0)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (1.4.1)
    transloadit (1.2.0)
      mime-types (~> 2.99)
      multi_json
      rest-client
    transloadit-rails (1.1.2)
      mime-types (~> 2.99)
      railties (>= 3)
      transloadit (>= 1.1.1)
    turbolinks (2.5.3)
      coffee-rails
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    tzinfo-data (1.2015.7)
      tzinfo (>= 1.0.0)
    uglifier (2.7.2)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.1-x86-mingw32)
    warden (1.2.4)
      rack (>= 1.0)
    whenever (0.9.4)
      chronic (>= 0.6.3)
    will_paginate (3.0.7)
    will_paginate-bootstrap (1.0.1)
      will_paginate (>= 3.0.3)

PLATFORMS
  x86-mingw32

DEPENDENCIES
  activeadmin!
  aws-sdk-v1 (= 1.66.0)
  braintree (= 2.55.0)
  cocoon (= 1.2.6)
  coffee-rails (~> 4.0.0)
  devise (= 3.5.2)
  figaro (~> 0.7.0)
  jbuilder (~> 2.0)
  jquery-rails (= 4.0.5)
  jquery-turbolinks (= 2.1.0)
  mediaelement_rails (= 0.8.2)
  meta-tags (= 2.1.0)
  mysql2 (= 0.4.2)
  nokogiri
  omniauth-facebook (= 3.0.0)
  paperclip (~> 4.3)
  quiet_assets
  rails (= 4.2.5)
  ransack (= 1.7.0)
  ratyrate (= 1.2.2.alpha)
  sass-rails (~> 4.0.3)
  sdoc (~> 0.4.0)
  simple_form (= 3.2.0)
  sitemap_generator (= 5.1.0)
  transloadit-rails (= 1.1.2)
  turbolinks (= 2.5.3)
  tzinfo-data
  uglifier (>= 1.3.0)
  whenever (= 0.9.4)
  will_paginate (~> 3.0.6)
  will_paginate-bootstrap (= 1.0.1)

BUNDLED WITH
   1.10.6

回答1:


Looks like you are developing on a Windows machine. My guess is that you are trying to deploy to Linux. I'm sorry to say, that's not going to work.

You'll notice that your Gemfile.lock has references to the x86-mingw32 version of Nokogiri, which can't be used on the server.

There is no easy solution to this, unfortunately. Heroku solves this problem by completely deleting the Gemfile.lock during deployment, which forces Bundler to re-resolve all dependencies. This works, but now your dependencies are no longer locked and are unpredictable. Heroku will say:

Removing Gemfile.lock because it was generated on Windows. Bundler will do a full resolve so native gems are handled properly. This may result in unexpected gem versions being used in your app. In rare occasions Bundler may not be able to resolve your dependencies at all. https://devcenter.heroku.com/articles/bundler-windows-gemfile

You could do something similar in Capistrano with some custom code that deletes Gemfile.lock before the Bundler task runs (or just remove Gemfile.lock from source control entirely). You'd also have to change the Bundler arguments to remove the --deployment flag, otherwise it will fail when it sees the Gemfile.lock is missing.

Or you could switch your development environment to Mac or Linux, e.g. by using a Linux VM for development.



来源:https://stackoverflow.com/questions/34604839/corrupt-gemfile-lock-error-with-capistrano

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!