Bundler Encoding :: CompatibilityError

时间:2011-10-31 15:28:53

标签: bundler

每当我在Rails项目上运行bundle install(或bundle update)时,我都会收到以下错误:

.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

这个问题让我完全糊涂了。任何帮助非常感谢!

1 个答案:

答案 0 :(得分: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')