每当我在我的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的内容。我正在提供核心rails的宝石:
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这个问题完全把我难倒了。任何帮助都非常感谢!
发布于 2011-10-31 23:33:49
这似乎是一个已知的错误:
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')https://stackoverflow.com/questions/7955834
复制相似问题