2011-10-31 37 views
0

每當我在我的Rails項目我碰到下面的錯誤運行bundle install(或bundle update):捆紮機編碼:: CompatibilityError

.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.7/lib/bundler/definition.rb:288:in `ensure_equivalent_gemfile_and_lockfile': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError) 

這裏是我的Gemfile的內容。我正在銷售核心軌道寶石:

source 'http://rubygems.org' 

gem 'rails', :path => 'vendor/bundle/ruby/1.9.1/bundler/gems/rails-5c591e5c969a' 
gem 'actionmailer', :path => 'vendor/bundle/ruby/1.9.1/bundler/gems/rails-5c591e5c969a' 
gem 'actionpack', :path => 'vendor/bundle/ruby/1.9.1/bundler/gems/rails-5c591e5c969a' 
gem 'activemodel', :path => 'vendor/bundle/ruby/1.9.1/bundler/gems/rails-5c591e5c969a' 
gem 'activerecord', :path => 'vendor/bundle/ruby/1.9.1/bundler/gems/rails-5c591e5c969a' 
gem 'activeresource', :path => 'vendor/bundle/ruby/1.9.1/bundler/gems/rails-5c591e5c969a' 
gem 'activesupport', :path => 'vendor/bundle/ruby/1.9.1/bundler/gems/rails-5c591e5c969a' 
gem 'railties', :path => 'vendor/bundle/ruby/1.9.1/bundler/gems/rails-5c591e5c969a' 

gem 'sprockets', :git => 'https://github.com/sstephenson/sprockets.git' 


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

gem 'pg' 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', "~> 3.1.0.rc" 
    gem 'coffee-rails', "~> 3.1.0.rc" 
    gem 'uglifier' 
end 

gem 'jquery-rails' 

# Use unicorn as the web server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'ruby-debug19', :require => 'ruby-debug' 

group :development do 
    gem 'sqlite3' 
end 

group :test do 
    # Pretty printed test output 
    gem 'turn', :require => false 
end 

這個問題讓我完全難住。任何幫助非常感謝!

回答

0

這似乎是一個已知的錯誤:

https://github.com/carlhuda/bundler/issues/926

試着在後面加上:

.force_encoding('ASCII-8BIT') 

:path選項,例如

:path => 'vendor/bundle/ruby/1.9.1/bundler/gems/rails-5c591e5c969a'.force_encoding('ASCII-8BIT')