捆绑安装不适用于 ubuntu

捆绑安装不适用于 ubuntu

每次我在 rails 应用上运行 bundle install 时,都会出现以下错误。可能是因为我刚刚将操作系统从 windows 更改为 linux(ubuntu)

  Fetching source index for http://rubygems.org/
/home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:133:in `load': marshal data too short (ArgumentError)
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:133:in `fetch_spec'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/remote_specification.rb:47:in `_remote_specification'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/remote_specification.rb:53:in `method_missing'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:128:in `tsort_each_child'
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/tsort.rb:203:in `each_strongly_connected_component_from'
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:124:in `block in tsort_each_node'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:124:in `each'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:124:in `tsort_each_node'
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/tsort.rb:135:in `tsort'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:107:in `sorted'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/installer.rb:49:in `run'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler

    /installer.rb:8:in `install'
        from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/cli.rb:222:in `install'
        from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `run'
        from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in `dispatch'
        from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
        from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/bin/bundle:13:in `<top (required)>'
        from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `load'
        from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `<main>'

 Fetching source index for http://rubygems.org/
/home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:133:in `load': marshal data too short (ArgumentError)
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:133:in `fetch_spec'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/remote_specification.rb:47:in `_remote_specification'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/remote_specification.rb:53:in `method_missing'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:128:in `tsort_each_child'
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/tsort.rb:203:in `each_strongly_connected_component_from'
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:124:in `block in tsort_each_node'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:124:in `each'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:124:in `tsort_each_node'
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
    from /home/rzaartz/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/tsort.rb:135:in `tsort'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:107:in `sorted'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/installer.rb:49:in `run'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/installer.rb:8:in `install'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/cli.rb:222:in `install'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in `dispatch'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.15/bin/bundle:13:in `<top (required)>'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `load'
    from /home/rzaartz/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `<main>'

我使用bundle install的 ruby​​ 版本是 ruby​​1.9.2,所以我的 gem 文件也是

source 'http://rubygems.org'

gem 'rails', '3.1.0.rc4'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'mysql2'

# Asset template engines
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-script'
gem 'uglifier'

gem 'jquery-rails'
gem 'devise', "~> 1.3.4"
gem 'amistad', "~> 0.7.4"
gem 'cancan'
gem 'paperclip', "~> 2.3.11"
gem 'ancestry', "~> 1.2.4"
gem 'kaminari'
gem 'meta_search'

组:开发做 gem 'nifty-generators' 结束

bundler 版本是 v-1.0.15 ruby​​gem-update 1.8.5

答案1

删除文件夹.gem中的文件夹$HOME将解决此问题。

相关内容