【问题标题】:Bundler Encoding::CompatibilityErrorBundler 编码::CompatibilityError
【发布时间】:2011-10-31 15:28:52
【问题描述】:

每当我在我的 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

这个问题把我彻底难住了。非常感谢任何帮助!

【问题讨论】:

    标签: bundler


    【解决方案1】:

    这似乎是一个已知的错误:

    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')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-02-08
      • 1970-01-01
      • 2012-07-29
      • 2013-11-16
      • 1970-01-01
      • 2021-01-22
      • 1970-01-01
      相关资源
      最近更新 更多