任何bundle命令都会清除Gemfile.lock文件内容

时间:2015-10-21 14:58:55

标签: ruby-on-rails ruby rubygems

当前的Gemfile.lock是这样的:

GIT
  remote: git://github.com/collectiveidea/awesome_nested_set.git
  revision: 57bada268cbca6cdc7dd3656d943ef1b76fbc3c0
  specs:
    awesome_nested_set (3.0.1)
      activerecord (>= 4.0.0, < 5)

GIT
  remote: git://github.com/plataformatec/simple_form.git
  revision: a28012bf2f2aa6dabd2b1efd5a306279cb3c885e
  specs:
    simple_form (3.1.0)
      actionpack (~> 4.0)
      activemodel (~> 4.0)

GEM
  remote: https://rubygems.org/
  remote: https://rails-assets.org/
  specs:
    actionmailer (4.2.0)
      actionpack (= 4.2.0)
      actionview (= 4.2.0)
      activejob (= 4.2.0)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.0)
      actionview (= 4.2.0)
      activesupport (= 4.2.0)
      rack (~> 1.6.0)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)
    actionview (4.2.0)
      activesupport (= 4.2.0)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.1)
    activejob (4.2.0)
      activesupport (= 4.2.0)
      globalid (>= 0.3.0)
    activemodel (4.2.0)
      activesupport (= 4.2.0)
      builder (~> 3.1)
    activerecord (4.2.0)
      activemodel (= 4.2.0)
      activesupport (= 4.2.0)
      arel (~> 6.0)
    activesupport (4.2.0)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    rails-assets-caman (4.1.2)
    rails-assets-classie (1.0.1)
    rails-assets-cssfx (0.9.6)
    rails-assets-doc-ready (1.0.4)
      rails-assets-eventie (>= 1, < 2)
    rails-assets-embedly-jquery (3.1.2)
    rails-assets-enquire (2.1.2)
    rails-assets-eventEmitter (4.2.11)
    rails-assets-eventie (1.0.6)
    rails-assets-fizzy-ui-utils (1.0.1)
      rails-assets-doc-ready (~> 1.0.4)
      rails-assets-matches-selector (~> 1.0.2)
    rails-assets-get-size (1.2.2)
      rails-assets-get-style-property (~> 1.0)
    rails-assets-get-style-property (1.0.4)
    rails-assets-imagesloaded (3.1.8)
      rails-assets-eventEmitter (~> 4.0)
      rails-assets-eventie (>= 1.0.4, < 2)
    rails-assets-iscroll (5.1.2)
    rails-assets-jquery (2.1.4)
    rails-assets-jquery-bridget (1.1.0)
      rails-assets-jquery (>= 1.4.2, < 3)
    rails-assets-jquery-deserialize (1.3.1)
      rails-assets-jquery (>= 1.4.3)
    rails-assets-jquery-hoverIntent (1.8.1)
      rails-assets-jquery (>= 1.9.1)

PLATFORMS
  ruby

DEPENDENCIES
  annotate
  awesome_nested_set!
  bcrypt    
  quilt
  rack-attack
  rails (= 4.2)!
  rails-assets-caman!
  rails-assets-cssfx!
  rails-assets-embedly-jquery!
  rails-assets-enquire!
  rails-assets-imagesloaded!
  rails-assets-iscroll (= 5.1.2)!
  rails-assets-jquery-bridget!
  rails-assets-jquery-deserialize!
  rails-assets-jquery-hoverIntent!
  rails-assets-jquery-infield-label!
  rails-assets-jquery.caro!
  rails-assets-jquery.center.js!

运行bundlebundle install只是删除整个Gemfile.lock内容并将其保留为:

GEM
  remote: https://rubygems.org/
  remote: https://rails-assets.org/
  specs:

PLATFORMS
  ruby

DEPENDENCIES

捆绑命令的输出:

The Gemfile specifies no dependencies
Resolving dependencies...
Your bundle is complete!
It was installed into ./vendor/bundle

为什么这样做?

1 个答案:

答案 0 :(得分:1)

Bundler版本(1.6.2相当陈旧)及其配置出现问题,只需删除配置并更新捆绑包:

cd app_dir
rm -v .bundle/config
gem update bundler
bundle install

在发出最后一个命令之前,请确保Gemfile语法正确。